Bukdu.jl
Bukdu.jl copied to clipboard
--color=no is ignored
From that I understand looking at the code Bukdu forces color output for logging even if julia is started with julia --color=no. This creates pretty messy logging in terminals which don't support color (in my case aws console)
I have the following workaround for now in my code:
#fix bug in Bukdu, which forces color output, ignoring command line arguments
force_bw = Base.JLOptions().color == 2
import Base.IOContext
using Base: ImmutableDict, unwrapcontext
function Base.IOContext(io::IO, dict::ImmutableDict)
force_bw ? dict = ImmutableDict(dict, :color => false) : nothing
io0 = unwrapcontext(io)[1]
IOContext{typeof(io0)}(io0, dict)
end
ideally of course Bukdu should respect --color=no switch in julia
thanks for the issue
could you test it again with master branch?
Sorry, took a while.
I think the fix is doing not exactly right thing (IMHO, but not a big deal for me)
the fix shuts down color unless the user calls --color=yes, i.e. by default it is no color. Plus, somehow it shuts down color for other loggers.
I would expected: if user doesn't call --color, it is automatic. which is not the case with the current fix
I tried in Windows10 and ubuntu (in virtualbox with Windows and the host)
thanks. could you test it again?
yes now it works as expected. Thanks!
Although, I didn't test in a terminal which doesn't support color.
I see that the current fix, just like my hack above checks if --color=no is pushed or not. I think (can't find it now) in julia they check both what user pushed and what terminal supports. and set color only if user pushed --color=yes or nothing is pushed (--color=auto) and terminal actually supports color.
i.e. I think the current fix will force color on terminals which don't support it, even if user set --color=auto (or didn't push anything)
I don't worry about the terminals for supporting colors or not. untested terminals like https://github.com/microsoft/terminal :)