Skip to content
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

Logging lazy strings with unicode characters errors #50

Open
lassepe opened this issue Sep 10, 2024 · 0 comments
Open

Logging lazy strings with unicode characters errors #50

lassepe opened this issue Sep 10, 2024 · 0 comments

Comments

@lassepe
Copy link

lassepe commented Sep 10, 2024

MWE:

using TerminalLoggers, Logging
with_logger(TerminalLogger()) do
    @warn lazy"σ"
end

throws

ERROR: MethodError: no method matching IOBuffer(::LazyString)
The type `IOBuffer` exists, but no method is defined for this combination of argument types when trying to construct it.

Closest candidates are:
  IOBuffer(::SubString{String})
   @ Base strings/io.jl:309
  IOBuffer(::String)
   @ Base strings/io.jl:308
  IOBuffer(; read, write, append, truncate, maxsize, sizehint)
   @ Base iobuffer.jl:119
  ...

Stacktrace:
  [1] parse(markdown::LazyString; flavor::Markdown.Config)
    @ Markdown ~/.julia/juliaup/julia-1.11.0-rc3+0.x64.linux.gnu/share/julia/stdlib/v1.11/Markdown/src/Markdown.jl:35
  [2] format_message(message::LazyString, prefix_width::Int64, io_context::IOContext{Base.TTY})
    @ TerminalLoggers ~/.julia/packages/TerminalLoggers/FYGc9/src/TerminalLogger.jl:125
  [3] handle_message(logger::TerminalLogger, level::Base.CoreLogging.LogLevel, message::LazyString, _module::Module, group::Symbol, id::Symbol, filepath::String, line::Int64; maxlog::Nothing, sticky::Nothing, kwargs::@Kwargs{})
    @ TerminalLoggers ~/.julia/packages/TerminalLoggers/FYGc9/src/TerminalLogger.jl:309
  [4]
    @ TerminalLoggers ~/.julia/packages/TerminalLoggers/FYGc9/src/TerminalLogger.jl:284
  [5] #invokelatest#2
    @ ./essentials.jl:1054 [inlined]
  [6] invokelatest
    @ ./essentials.jl:1051 [inlined]
  [7] macro expansion
    @ ./logging/logging.jl:388 [inlined]
  [8] (::var"#1#2")()
    @ Main ./REPL[4]:2
  [9] with_logstate(f::var"#1#2", logstate::Base.CoreLogging.LogState)
    @ Base.CoreLogging ./logging/logging.jl:522
 [10] with_logger(f::Function, logger::TerminalLogger)
    @ Base.CoreLogging ./logging/logging.jl:632
 [11] top-level scope
    @ REPL[4]:1
Some type information was truncated. Use `show(err)` to see complete types.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant