-
Notifications
You must be signed in to change notification settings - Fork 31
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
Major refactor of internal Log module #54
Conversation
We move to a class from a module and on instantiation also instantiate a class for our global_context that we freeze in place. This removes the idea of adding to our global_context once we've instantiated our logger. The rewrite was to address the new signal/thread handling in Ruby 2.0. Details can be found in #53. I think this also provides us with some flexibility around global context in the future. Unfortunately this is not backward compatiable with current Scrolls releases.
Heh just realized that I simultaneously supported 1.8.7 in our parser tests and dropped it for the project as a whole. |
@asenchi Nice. Looking forward to this landing |
All of this seems reasonable to me and like a step in the right direction. I prefer instantiation. |
Now that ruby 1.9.3 is in security fixes only mode I am very excited to get this merged and deployed! Do you need any help or alpha testers for this change? |
@asenchi can you give an example of the new single line exception log format? |
I will be working to refactor this code since it has sat stale for so long. Apologies for my lax behavior here. I cut a new release with the current behavior here in preparation for this work. |
This commit breaks backwards compatability for Scrolls. It is a rework/refactor of the initial work done in the following PR: #54 - The `global_context` is no longer mutable, instead we instantiate a class internally inside Scrolls::Logger that contains the `global_context`. This is to avoid various bad thread behaviors, that previous to Ruby 2.0, were allowed. - The result of the above change removes `#add_global_context`. - Currently Scrolls needs to be instantiated to be used (`Scrolls.init(options)`) however I'd like to work on a method for allowing one to just use `Scrolls.log` and get sane defaults. - Due to this massive change I moved to "single line exceptions" by default since it lowers the amount of data produced by Scrolls when using `#log_exception` without losing the information.
Replaced by #71. |
To address #53 this restructures our internal log object. Instead of a module we move to a class that is instantiated upon using
#init
. This breaks current Scrolls behavior in the following ways:global_context
is no longer mutable, instead we instantiate a class internally inside Scrolls::Logger that contains theglobal_context
. This is to avoid various bad thread behaviors, that previous to Ruby 2.0, were allowed.#add_global_context
.Scrolls.init(options)
) however I'd like to work on a method for allowing one to just useScrolls.log
and get sane defaults.#log_exception
without losing the information.I've currently got all tests passing:
I'd like some review on this approach. If the following people wouldn't mind reviewing I would greatly appreciate it: @gorsuch @dpiddy @eric