-
Notifications
You must be signed in to change notification settings - Fork 6
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
Selectively disable logging for a module #17
Comments
There's a way to do this with the older module ModuleA
function hello()
@info "hello"
end
end
module ModuleB
using ..ModuleA
function world()
ModuleA.hello()
@info "world"
end
end Thence julia> using MicroLogging
julia> global_logger(InteractiveLogger(stdout))
julia> ModuleB.world()
I- hello Info REPL[8]:3
I- world Info REPL[14]:5
julia> configure_logging(ModuleA, min_level=MicroLogging.Warn)
julia> ModuleB.world()
I- world Info REPL[14]:5 Unfortunately in answering this question I've realized |
Thanks for the reply. If I were not using MicroLogging and only using standard Logging would you recommend copying over the config.jl file? What is the recommended best practice here? |
The recommended practice is to help me improve the mess which is logging configuration and filtering ;-) I'm afriad there's just no predefined way to do sophisticated log filtering and configuration in julia-1.0 because I hadn't figured it out in time for 0.7 and didn't want to merge something half baked. Having said that, the existing system is very flexible. What you can do is:
Right now, I'm hoping people will dive in and do this in packages. Either here in |
Haha got it. I'll play around with it and if I find any patterns emerge from my use I'll report back here and we can discuss where to submit PRs. |
Excellent! I'd rather keep extensions out of stdlib/Logging until we've got a somewhat complete solution. Only because the stdlib is currently versioned in lockstep with Base, and I'd hate to release something half baked in julia-1.1 See also JuliaLang/julia#29567 (comment) |
Maybe we should just make |
I've come to the conclusion that we should probably just split |
Let's say I have the following codebase, consisting of three files,
modulea.jl
,moduleb.jl
andmain.jl
If I want to show only
@error
outputs from ModuleB but only@info
and above from ModuleA, is there a way of doing that by only adding code in the commented block and not changing the remaining codebase?The text was updated successfully, but these errors were encountered: