chelseas / GlowupVibes.jl

MIT License
19 stars 1 forks source link

The sus macro is sus #2

Open mkitti opened 11 months ago

mkitti commented 11 months ago

The @sus macro says that GlowupVibes is sussing. However, the REPL is the one sussing...

julia> @sus "The red one is sus"
┌ Warning: The red one is sus
└ @ Main ~/.julia/packages/GlowupVibes/Rkk2K/src/GlowupVibes.jl:25

julia> @warn "The red one is sus"
┌ Warning: The red one is sus
└ @ Main REPL[9]:1
mkitti commented 11 months ago

This is as far as I've gotten so far.

using Base.CoreLogging: logmsg_code, LogLevel, _min_enabled_level, current_logger_for_env, shouldlog, handle_message, @_sourceinfo, logging_error
using Base.CoreLogging: Debug, Info, Warn, Error

macro sus(exs...)
     logmsg_code((@_sourceinfo)..., :Warn, exs...)
end
julia> using GlowupVibes

julia> x = 5
5

julia> @sus "Hello world" x
┌ Warning: Hello world
│   x = 5
└ @ Main REPL[7]:1

My earlier attempt was to build a macrocall expression but this has problems displaying x as above.

macro sus(exs...)
    Expr(:macrocall, Symbol("@warn"), __source__, exs...)
end
chelseas commented 10 months ago

Can you elaborate some more on what is sus? Is it that it doesn't quote the correct line of source code in the log message?

mkitti commented 10 months ago

Facts. The REPL[8] is sus not GlowupVibes.jl:25.