-
Notifications
You must be signed in to change notification settings - Fork 106
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
replace logging module with nim-chronicles (see #38) #117
Conversation
Are you saying that Chronicles was slower than the standard Nim logging? That would be surprising to me, becauswe Chronicles is trying to produce very efficient inline code for all logging statements - a possible source of slowdown could only be the use of colors or the enforced flushing of the terminal writes (we can try to disable both to see how this will affect the performance). Can you elaborate on the problems of |
I'm saying that enabling the gas cost logs when running tests leads to copious amounts of logs - this is a side effect of
Performance-wise, it's made worse by the multi-line format which leads to more vertical scrolling which is slower in both raw terminal and vscode.. the main problem here however is the sheer amount of logs - no microoptimizations will help with that.
take something like vmstate - it creates a local logging instance that binds a name to a logging instance, like here: https://github.com/status-im/nimbus/pull/117/files#diff-a7a876ef1218263fa676fb87b3421be8L49 - it seems tricky to find a good scope that achieves the same effect.. suggestions? |
I guess the clean solution here is to define a set of logging overloads ( template info(vm: BaseVmState, eventName: static[string], props: varargs[untyped]) =
chronicles.info(eventName, vmName = vm.name, props)
# elsewhere in the code:
vmState.info "some event", someProp = x I can turn this into a generic scheme for obtaining properties from such a "first parameter" object if we think this common enough and worthwhile. A more dirty solution is just to add a log scope that expects that the |
Let's just comment out the problematic logs for now. Adding |
doesn't look like a beautiful solution - I'd just let it slide for now.. potentially one could have the framework check for |
The framework can make the overloading approach a bit easier by letting you overload just It's also possible to go crazy with conditional code in |
sounds like that might place a higher burden on the user of the framework - instead of just implementing a simple tolog converter that's only concerned with converting object to logging data, they now have to know much more about the internals of the framework and write more complicated stuff to deal with passing on other log parameters etc. it also seems less extensible - what if we have to types that need special consideration (a p2p client that logs name+ip and a vm that logs minimal state info, for example)
ouch. that would constrain the name of the variable that you can use - so if you have two instances in the same scope, you're done - it also doesn't help in other scopes where you want a "canonical" representation of what the object you're logging is. |
|
LGTM, but the PR has conflicts and needs to be rebased now. |
This blindly changes logging to nim-chronicles - issues that ensue: * keeps gas cost computation logs hidden behind flag * unclear if logScope is practical - for example, since vm is split over many files, topics get lost when using simple top-level per-module topics * when passing named object around, scope should incliude the name of the object but this is caught neither by logScope nor by dynamicLogScope
57927e4
to
db202dc
Compare
This blindly changes logging to nim-chronicles - issues that ensue:
of magnitude (lacking trace level) - the problem is further exacerbated
by chronicles' default multi-line output
many files, topics get lost when using simple top-level per-module
topics
the object but this is caught neither by logScope nor by dynamicLogScope