-
Notifications
You must be signed in to change notification settings - Fork 5
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
Feature/logger refactor #86
base: develop
Are you sure you want to change the base?
Conversation
… global var Space.log
…rlying library for Space.Logger
@@ -165,11 +170,47 @@ class Space.Module extends Space.Object | |||
this[hook] ?= -> | |||
this[hook] = _.wrap(this[hook], wrapper) | |||
|
|||
_setupLogger: -> | |||
config = Space.configuration.log |
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.
So we can do away with the Space.configuration
as that was only needed since we were previously initialising the logger instance outside the module chain. This will be really nice to see gone
Nice start @qejk , really excited to see this design fleshed out! cc @DominikGuzei @darko-mijic Please review |
… multiple logging adapters in Space.Logger, adds adapter for console, winston logging libraries, wires everything up in module.coffee
…ds setMinLevel, adds removable transports at winston adapter
Great work here, the only thing i'm concerned with is the default logger complexity this brings into Another problem is the new code in Coffeescript 😜 we want to move to ES6 |
We did discuss the idea of breaking out the console (default) logger, but deferred the idea, as the first step was just to make the code modular. It's a little more complex due to the fact that I vote for the approach with the client and server adaptors in separate packages, because in production a client logger makes little sense, so can see it purely as a development tool. Also @qejk will be converting to ES6 when the design is fleshed out. |
Yes, moving this into a general purpose configurable logger package that has no idea about Space will be the best option. This is the way forward! Remember, packages like this are the goal: very small, focussed and highly documented (because it's easy!) |
@DominikGuzei Changes will be moved to ES6 when I'm fully happy with them. Don't have much time currently and I'm faster with CS when prototyping. Normally this would be like Rhys said - noop logger that can handle multiple logging libraries with granular control over them however developer pleases(and by that how he write his own adapter wink wink). With JS there is limited way how to handle things because of lack of interfaces, so some sacrifices must be made when using typical OOP patterns, so would like to hear if this is the right direction to go. Currently I would like to refactor only this ugly pice of code: Line 197 in 64f90e0
Space.Logger is ok around with module vs app initialization, since I know only how things works partially.
Moving this to another module will require rethinking everything from ground up, since Line 30 in 64f90e0
|
Yep, that's another possibility – make it configurable in a way that |
…ntained in additional packages
}) | ||
|
||
|
||
}); |
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.
@qejk Do you have .eslintrc checking the format? This should be a new line
…eature/logger-refactor # Conflicts: # package.js
Refactors
Space.Logger
, its initialization, and removes unnecessary use ofSpace.log
global var. Enables to pass multiple transports to underlying library for logging (winston) through application config like: