GlowupVibes.jl icon indicating copy to clipboard operation
GlowupVibes.jl copied to clipboard

The sus macro is sus

Open mkitti opened this issue 2 years ago • 3 comments

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 avatar Oct 24 '23 05:10 mkitti

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

mkitti avatar Oct 24 '23 06:10 mkitti

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?

chelseas avatar Nov 06 '23 14:11 chelseas

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

mkitti avatar Nov 07 '23 05:11 mkitti