-
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
Logging Improvements #15
Comments
You can decrees number of log messages by setting ERROR level. Also I agree that we could improve that (global variables are not best practice) but for know I think this one do not have high priority. Regarding additional gems I would like to avoid adding something which will not provide any additional value. I know that logging is very important but in most cases Logger class from ruby core can do the job. Those gems can do some magic staff but do we really need that in such simple app? This what I suggest:
|
I understand how to manipulate the logger into being less chatty in test, I just noticed a deficiency in our current process and thought I would get some discussion started. As for external gems for logging, they don't provide any magic but they do bring two very useful features to the party:
I agree that our current t needs don't warrant anything more complex, fortunately the logging gem's base API is completely compatible with the built in one so when we change our minds we can change our code easily. |
I do not mind to use those gems I just would like to know why. I am fine with that what we have right now it covers all my needs, this is why I do not see any additional value by adding those gems.
I will be glad if you could provide my some examples how we could benefit from those features. |
Multiple output streams isn't really necessary until you have very large deployments but the name spaced logging is quite useful. For example (totally contrived but illustrative): Say I have a custom ticket validation process that checks several parameters on the tickets and some web API I have set up so I can tune these things on the fly but I'm having trouble with the parameter checking and can't identify it in testing. As things sit if I want to see real logging coming out of this single class at the DEBUG level in production I have to set the whole app to DEBUG. This would lead to very large log files that would be essentially useless for debugging purposes without writing a log evaluation tool for this single scenario. Now consider if I could just set that class to DEBUG and leave the rest of the app at WARN or ERROR I would have a reasonable log file I could parse by hand or off the shelf tools quickly to see where the breakdown is occurring. |
Thanks a lot for that example. |
read login message flash from cross domain
Perhaps we should move away from the global $LOG and to something that self initializes to a null logger if one isn't configured. Maybe, we could also set it up so we can simply call
logger.warn
to put out a message. If we do this last bit or not doesn't really matter but we need to stop polluting our test output with log messages going to STDOUT.Also, perhaps we can also use one of the more advanced logging gems (log4r or logging) so we can have more precise control over what gets logged. The real advantage here would be that you can tune the logging level of various classes/namespaces without changing them all.
The text was updated successfully, but these errors were encountered: