bunyan icon indicating copy to clipboard operation
bunyan copied to clipboard

Dev

Open mikehentges opened this issue 4 years ago • 2 comments

Still in draft form - but the tests pass. Created an option -c (compare) based on the description of the node version of bunyan. Currently implemented for a few of the easy base JSON fields. Constrained to the comparison operators, rather than "any javascript" the node version allows. Intend on expanding to include the JSON in the "extra" field as well.

Not sure the effort to create types for the comparison is necessary - as that will not be possible for the free-form JSON in the extra field. Might need to simplify this down to just String comparisons.

mikehentges avatar Oct 27 '21 13:10 mikehentges

Finally found the time to have a look - it looks quite promising! A few comments:

  • The parsing of the comparison condition should happen once, at the beginning, not every time you need to check if a line matches the condition;
  • As you noted, we need something more dynamic to handle the extra keys, which is where the real fun begins;
  • Does the JS version of bunyan allow chaining of comparisons? I.e. x == 2 && y == 3?

LukeMathWalker avatar Nov 24 '21 11:11 LukeMathWalker

Thanks for the feedback!

The JS version of bunyan allows an “arbitrary JS expression” for a filter. One of the advantages of a dynamic language! I started with a simple one-field comparison to get started, a chain of comparisons would be a logical next step – but I don’t know if defining a “language” for something more complicated than that would be worth the effort.

mikehentges avatar Nov 25 '21 17:11 mikehentges