Thor logs cli
setup and help
npm install -g thor-logs-cli
> thor-logs --help
example
> thor-logs list --status=pending
outputs:
{ "pending": [], "start": [ "/logs/1.log" ], end: ["/logs/2.log"], error: [] }
or
> thor-logs list --status=pending
outputs:
{ "pending": [] }
Combine scan and splitToFiles to create the perfect input for retransmitter:
scan will output something like
{ "MobileCoreTxns": { "pending": { "files": [ array ] }, "end": { "files": [ array ] } }, "MobileCoreAdServerLoopbacks": { etc... } }
then piping it to splitToFiles will write the following files:
MobileCoreTxns.pending.json - will contain { "files": [array] } MobileCoreTxns.end.json MobileCoreAdserverLoopbacks.pending.json etc...
it will also print all the files that it created to the console like so:
{ "files": [ "/path/to/MobileCoreTxns.pending.json", .... etc ] }
reuse list functionality
var cli = require('thor-logs-cli')
// targetPath - path to files
// extension - the base extension, e.g 1.log.active, 1.log.end, so log is the extension
// match - a string to match in all the returned files
// statusFiles - an array of statuses to include, [ 'pending', 'end'] will return { pending: [...files...], end: [...files] }
// if one status is specified, then the json will be { files: [] }
// includeEmptyFiles - whether to return empty log files or not
// files - an array of files in the path (e.g the result of fs.readdir call)
cli.list(targetPath, extension, match, statusFilter, includeEmptyFiles, files)