Skip to content
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

unified logging concept cli / petridish / git-server #79

Closed
tripodsan opened this issue Aug 14, 2018 · 4 comments
Closed

unified logging concept cli / petridish / git-server #79

tripodsan opened this issue Aug 14, 2018 · 4 comments
Labels
enhancement New feature or request

Comments

@tripodsan
Copy link
Contributor

It would be great to use a standardized logging concept withinh the console apps.
winston supports categories: https://github.com/winstonjs/winston/blob/master/README.md#working-with-multiple-loggers-in-winston and we could use this:

  • each class/file acquires the logger via winston.loggers.get() (eg. winston.loggers.get('git-server')
  • onInit of a module, it checks if the respective category is already present (winston.loggers.has()) and if not, configures it.
  • maybe create a helix-winston-config module for harmonization.
@tripodsan tripodsan added the enhancement New feature or request label Aug 14, 2018
@trieloff
Copy link
Contributor

I'd throw the runtime itself into the mix, too. I think you want to drill-down/filter your logs by:

  • component/environment (git-server, cli, parcel, petridish, openwhisk)
  • customer code (file name)
  • request ID

@tripodsan
Copy link
Contributor Author

I just realized that each module uses its own instance of winston. so the global logger context would need to be passed around.

@trieloff
Copy link
Contributor

We should have only two places where Winston instances get created:

  • in development: in helix-cli
  • in production: in openwhisk-loggly-wrapper

trieloff added a commit that referenced this issue Oct 22, 2018
trieloff added a commit that referenced this issue Oct 22, 2018
trieloff added a commit that referenced this issue Oct 22, 2018
trieloff added a commit that referenced this issue Oct 22, 2018
trieloff added a commit that referenced this issue Oct 22, 2018
trieloff added a commit that referenced this issue Oct 22, 2018
expand logger with a maybe level, which is just like `info`, but gets
surpressed when on TTY
trieloff added a commit that referenced this issue Oct 23, 2018
trieloff added a commit that referenced this issue Oct 23, 2018
Note: Petridish does not allow configurable loggers yet, so this
commit only covers the non-petridish logs in hlx up.
@tripodsan
Copy link
Contributor Author

we should also look into https://www.npmjs.com/package/bunyan, which has some cool features,
such as child loggers:

Bunyan has a concept of a child logger to specialize a logger for a sub-component of your application, i.e. to create a new logger with additional bound fields that will be included in its log records. A child logger is created with log.child(...).

this would allow to pass a child logger to, let's say petridish, which then can be configured differently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants