Skip to content

Commit

Permalink
Fix keyword handling related to changes in JuliaLang#24795
Browse files Browse the repository at this point in the history
  • Loading branch information
c42f committed Dec 3, 2017
1 parent e0a746e commit 992521f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion base/logging.jl
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ function handle_message(logger::SimpleLogger, level, message, _module, group, id
print_with_color(color, logger.stream, first(levelstr), "- ", bold=true)
print(logger.stream, replace(message, '\n', "\n| "))
println(logger.stream, " -", levelstr, ":", _module, ":", basename(filepath), ":", line)
for (key,val) in kwargs
for (key,val) in pairs(kwargs)
println(logger.stream, "| ", key, " = ", val)
end
end
Expand Down
7 changes: 3 additions & 4 deletions test/logging.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ end
@test length(logs) == 3

record = logs[1]

kwargs = Dict(record.kwargs)
kwargs = record.kwargs

# Builtin metadata
@test record._module == @__MODULE__
Expand All @@ -68,13 +67,13 @@ end
# Keyword values accessible from message block
record2 = logs[2]
@test ismatch((Info,"test2"), record2)
kwargs = Dict(record2.kwargs)
kwargs = record2.kwargs
@test kwargs[:value_in_msg_block] === 1000.0

# Splatting of keywords
record3 = logs[3]
@test ismatch((Info,"test3"), record3)
kwargs = Dict(record3.kwargs)
kwargs = record3.kwargs
@test sort(collect(keys(kwargs))) == [:a, :b]
@test kwargs[:a] === 1
@test kwargs[:b] === 2.0
Expand Down

0 comments on commit 992521f

Please sign in to comment.