Added README.md and versioning.
This commit is contained in:
parent
9a2fcf29dc
commit
b0e6e4d66f
56
README.md
Normal file
56
README.md
Normal file
@ -0,0 +1,56 @@
|
||||
# log\_happy
|
||||
|
||||
Little log viewer that watches for the presence of absence of expected phrases
|
||||
in log files. I found myself running programs with verbose logging output and
|
||||
frequently using tmux's buffer search feature to look for the presence or
|
||||
absence of specific text. It seemed useful to have a program that would scan
|
||||
the output as it was generated instead of having to go back and manually
|
||||
search later. That is what this tool does.
|
||||
|
||||
`log_happy` allows you to specify a log file it wil read, or a command it will
|
||||
execute and monitor. It also allows you to specify multiple regex's to expect
|
||||
either to find or not find in the output. It displays clearly which patterns
|
||||
where found and which were not and uses green and red text to show whether
|
||||
each pattern's presence matches your expectation.
|
||||
|
||||
## Usage
|
||||
|
||||
`log_happy` online help:
|
||||
|
||||
Usage:
|
||||
log_happy [options]
|
||||
log_happy <filename> [options]
|
||||
log_happy [options] -- <cmd>
|
||||
|
||||
Options:
|
||||
|
||||
-v Print version information and exit.
|
||||
-e<label>;<pattern> Add something to expect to see in the log stream.
|
||||
-E<label>;<patterh> Add something to expect not to see in the log stream.
|
||||
-d<def-file> Read expectations from a JSON definitions file.
|
||||
-i<in-file> Read JSON definitions from <in-file>.
|
||||
-o<out-file> Write the log to <out-file>. Usefull for viewing
|
||||
output later when executing commands.
|
||||
-f Similar to tail, do not stop when the end of file
|
||||
is reached but wait for additional modifications
|
||||
to the file. -f is ignored when the input is STDIN.
|
||||
|
||||
Expectation definitions take the format LABEL;REGEX where the LABEL is the text
|
||||
label log_happy will use to describe the event, and REGEX is the regular
|
||||
expression log_happy will use to identify the event.
|
||||
|
||||
## Definitions Format
|
||||
|
||||
`log_happy` also allows you to persist your expectations in a JSON definitions
|
||||
file. JSON expectation definitions follow this format:
|
||||
|
||||
{
|
||||
"expected": {
|
||||
"<label>": "<regex>",
|
||||
"<label>": "<regex>"
|
||||
},
|
||||
"unexpected": {
|
||||
"<label>": "<regex>",
|
||||
"<label>": "<regex>"
|
||||
}
|
||||
}
|
@ -35,6 +35,7 @@ when isMainModule:
|
||||
var outFile: File
|
||||
|
||||
try:
|
||||
let VERSION = "0.1.0"
|
||||
let usage = """
|
||||
Usage:
|
||||
log_happy [options]
|
||||
@ -43,9 +44,10 @@ Usage:
|
||||
|
||||
Options:
|
||||
|
||||
-v Print version information and exit.
|
||||
-e<label>;<pattern> Add something to expect to see in the log stream.
|
||||
-E<label>;<patterh> Add something to expect not to see in the log stream.
|
||||
-d<def-file> Specify a JSON definitions blob.
|
||||
-d<def-file> Read expectations from a JSON definitions file.
|
||||
-i<in-file> Read JSON definitions from <in-file>.
|
||||
-o<out-file> Write the log to <out-file>. Usefull for viewing
|
||||
output later when executing commands.
|
||||
@ -134,6 +136,10 @@ Expectations JSON definitions follow this format:
|
||||
expected: m[0] == "e",
|
||||
found: false))
|
||||
|
||||
elif arg == "-v":
|
||||
stdout.writeLine "log_happy v" & VERSION
|
||||
quit(QuitSuccess)
|
||||
|
||||
elif arg == "-f": follow = true
|
||||
elif arg == "--": cmd = ""
|
||||
else: exitErr "unrecognized argument: " & arg
|
||||
|
Loading…
Reference in New Issue
Block a user