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

The sus macro is sus #2

Open
mkitti opened this issue Oct 24, 2023 · 3 comments
Open

The sus macro is sus #2

mkitti opened this issue Oct 24, 2023 · 3 comments

Comments

@mkitti
Copy link

mkitti commented Oct 24, 2023

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
Copy link
Author

mkitti commented Oct 24, 2023

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
Copy link
Owner

chelseas commented Nov 6, 2023

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
Copy link
Author

mkitti commented Nov 7, 2023

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

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

2 participants