diff --git a/slfmt.nimble b/slfmt.nimble index 61afc3b..9a24a29 100644 --- a/slfmt.nimble +++ b/slfmt.nimble @@ -1,6 +1,6 @@ # Package -version = "0.2.4" +version = "1.0.0" author = "Jonathan Bernard" description = "Small utility to pretty-print strucutured logs." license = "MIT" @@ -11,4 +11,4 @@ bin = @["slfmt"] # Dependencies requires @["nim >= 2.2.0", "docopt >= 0.7.1"] -requires @["timeutils", "zero_functional"] +requires @["cliutils >= 0.11.0", "timeutils", "zero_functional"] diff --git a/src/slfmt.nim b/src/slfmt.nim index c40d6ba..e623606 100644 --- a/src/slfmt.nim +++ b/src/slfmt.nim @@ -1,25 +1,197 @@ -import std/[json, options, sequtils, streams, strutils, terminal, times] -import docopt, timeutils, zero_functional +import std/[atomics, json, options, os, posix, sequtils, setutils, strutils, + terminal, termios, times, unicode] +import cliutils, docopt, timeutils, zero_functional from std/logging import Level -from std/sequtils import toSeq +import std/nre except toSeq -const VERSION = "0.2.4" +const VERSION = "1.0.0" const USAGE = """Usage: - slfmt [options] + slfmt [options] Options: - -h, --help Print this usage and help information - -c, --compact Compact output - -l, --log-level Only show log events at or above this level - -n, --namespace Only show log events from this namespace + -h, --help Print this usage and help information + -c, --compact Compact output + -l, --log-level Only show log events at or above this level + -n, --namespace Only show log events from this namespace + + -e, --expected + + Add a filter for something expected to be present in the logs. It's + absence will be flagged. On the command-line, should be + formatted as: + + field-name:regex-pattern:label + +