Non-compact printing in logs in non-interactive sessions

In a long-running process I need to write out occasional numeric data. I found that it is printed compactly. MWE:

tamas@tamas-vivobook ~/src/mu % julia -e 'x = collect(1.0:50.0); @info "logging" x'
┌ Info: logging
│   x =
│    50-element Array{Float64,1}:
│      1.0
│      2.0
│      3.0
│      4.0
│      5.0
│      6.0
│      7.0
│      8.0
│      9.0
│     10.0
│     11.0
│     12.0
│     13.0
│      ⋮  
│     39.0
│     40.0
│     41.0
│     42.0
│     43.0
│     44.0
│     45.0
│     46.0
│     47.0
│     48.0
│     49.0
└     50.0

What’s the simplest way to make @info print all the elements in

(If this cannot be done, I can always revert to show, so I know a workaround)

The IOContext is hard-coded, so the best you can do is probably somethink like

julia> x = collect(1.0:50.0);

julia> @info "blah" sprint(show, x')
┌ Info: blah
└   sprint(show, x') = "[1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0 20.0 21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0 30.0 31.0 32.0 33.0 34.0 35.0 36.0 37.0 38.0 39.0 40.0 41.0 42.0 43.0 44.0
45.0 46.0 47.0 48.0 49.0 50.0]"

Thanks. Do you think it is worth opening an issue about this?

No, since I didn’t read the code correctly and the interesting value isn’t hardcoded. So you can just do

julia> global_logger(ConsoleLogger(show_limited=false))
ConsoleLogger(Base.TTY(Base.Libc.WindowsRawSocket(0x00000000000002ac) open, 0 bytes waiting), Info, Logging.default_metafmt, true, 0, Dict{Any,Int64}())

julia> @info "blah" x'
┌ Info: blah
│   x' =
│    1×50 LinearAlgebra.Adjoint{Float64,Array{Float64,1}}:
└     1.0  2.0  3.0  4.0  5.0  6.0  7.0  8.0  9.0  10.0  11.0  12.0  13.0  14.0  15.0  16.0  17.0  18.0  19.0  20.0  21.0  22.0  23.0  24.0  25.0  26.0  27.0  28.0  29.0  30.0  31.0  32.0  33.0  34.0  35.0  36.0  37.0  38.0  39.0  40.0
 41.0  42.0  43.0  44.0  45.0  46.0  47.0  48.0  49.0  50.0
3 Likes