-
Notifications
You must be signed in to change notification settings - Fork 34
Logger #46
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
base: master
Are you sure you want to change the base?
Logger #46
Conversation
|
Closes #41 |
|
Can you elaborate just a bit on your choice of vocabulary used in the api (such as |
|
The vocabulary comes from https://github.com/nomiddlename/log4js-node. An |
scottcorgan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few comments on the code.
Also, I like to take the safe approach and be explicit about default and custom configurations (from my Elm experience).
What do you think about the following APIs?
// Deafults to 'ALL' and 'console'
server.start({
logger: true
});
// Allows you to configure to how you'd like?
server.start({
customLogger: {
level: 'All',
appenders: [
{ type: 'console' }
]
}
});| app.use(compression()) | ||
|
|
||
| // First, check the file system | ||
| // configure logger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably only use the logger if they provide a config for it (not default to all the time)
package.json
Outdated
| "compression": "^1.1.0", | ||
| "connect": "^3.2.0", | ||
| "connect-static-file": "^1.1.2", | ||
| "log4js": "^1.1.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Go ahead and lock the dependency here to the latest current version. (I locked the dependencies recently to avoid any unknown breaking changes)
|
I tend to prefer that logging is enabled by default... but OK! |
scottcorgan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple more changes. I have to be picky with this because it's used by some big projects and I don't want to break those projects.
Thanks!
| { type: 'console' } | ||
| ] | ||
| }, | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, just a couple more changes, then it's ready to merge! 🎉 . Should probably add an example here of using a logger default values.
| const DIRECTORY = 'public' | ||
| const FILE = 'index.html' | ||
| const HOST = '0.0.0.0' | ||
| const LOGGEROPTIONS = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the default value for this should be false. Then we could check if it's true or an object, then attach the logger.
|
Any updates on this feature? |
It's generally useful for your web servers to have logs!