Skip to content

Commit

Permalink
adding logging.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
MichelJuillard committed Dec 27, 2023
1 parent 19eeb50 commit 71558e7
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/logging.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
function filter_logging_messages(log_args)
if log_args.level == Logging.Debug && ! occursin("Dynare", get(ENV, "JULIA_DEBUG", ""))
return false
end
return true
end

function set_logging(modname)
FT = TeeLogger(
ActiveFilteredLogger(
filter_logging_messages,
FormatLogger() do io, args
println(io, args.message)
end
),
ActiveFilteredLogger(
filter_logging_messages,
FormatLogger("$(modname).log") do io, args
println(io, args.message)
end
)
)
global_logger(FT)
end

0 comments on commit 71558e7

Please sign in to comment.