-
-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Passing options down the pipe #126
Comments
Prior to version 6 we had configuration piping, however it was removed as it was too difficult to reason about and maintain. Much clearer for options to not be inherited and merged, or at least leaving such to userland instead of core where they know the assumptions about merging and inheritance.
This would be a seperate thing, however I think it would also complicate matters as we need the pipes compatible with normal node and deno piping. Perhaps human could extend the log entry rather than convert it, however performance is critical as some apps do thousands of logs in a few seconds, and extensions would still not output the expected result when piping human to say stdout. |
Ok. It is interesting that I've come along after the fact and suggested something that was in place earlier. That would suggest there was and possibly still is a need. However I completely understand your position and am fine to just move on. I've made extensive changes to copies of Human and Browser to enable all ansi colors and styles to be used everywhere, and along the way simplified the code. However the Browser output is overly noisy as all objects are expanded, which I'm not used to. This makes sense in Node, however in the Browser simpler logging lets the user interactively expand and collapse objects which presents a far more compact (less noisy) output. So I'm now working at implementing an option for this simpler Browser logging style. However because of the loss of information piped from Human to Browser, it looks like I need to combine the two transforms into one. I'll keep you posted. |
The browser transform and the hunan transform could certainly be merged. The plan would be for an ansi package that outputs the style for the browser if in a browser environment. And either the one package does it automatically, or you configure the new human transform with the appropriate config for the environment. |
Yes, I'm using ansicolor which replaces your ansi code. Works a treat. I now have a combined human and browser module called superHuman 😀 which has target (browser/node) options amongst others. It's coming along nicely. It can either do the original colored and expanded output or the user expandable compact output like this: |
Lookin good |
It would be useful to be able to pass options along the pipe.
For example
Human
has an optioncolor
as doesBrowser
, which would typically be set the same. Both default totrue
, however if you want them to befalse
then you need to include{ color: false }
for both.Instead if
Human( opts )
could be passed toBrowser
etc. both client code and usage would be simplified as{ color: false }
would only need to be specified once.Similarly it would be handy if
LogEntry
could be passed down the pipe then theBrowser
transform could accessLogEntry
passed toHuman()
.Finally it would be useful if Transform's could access Logger options.
I do however realize that these suggestions maybe outside the design scope or even unwanted.
The text was updated successfully, but these errors were encountered: