Skip to content

Fix log message id from at-deprecate to be a Symbol. #40820

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ function depwarn(msg, funcsym; force::Bool=false)
end,
_file=String(caller.file),
_line=caller.line,
_id=(frame,funcsym),
_group=:depwarn,
frame=frame,
caller=caller,
maxlog=funcsym === nothing ? nothing : 1
)
Expand Down
13 changes: 13 additions & 0 deletions test/corelogging.jl
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,19 @@ end
@test record.group == :corelogging # name of this file
end

@testset "id from @deprecate should be ::Symbol" begin
code = """
import Test
f() = Base.depwarn("msg", :f; force=true)
logs, _ = Test.collect_test_logs() do
f()
end
Test.@test logs[1].id isa Symbol
"""
cmd = `$(Base.julia_cmd()) --depwarn=yes --startup-file=no -e $code`
@test success(run(cmd))
end

@testset "complicated kwargs logging macro" begin
@test_logs (:warn, "foo") @warn "foo" argvals=:((DoNotCare{$(Expr(:escape, :Any))}(),))
end
Expand Down