I currently have a struct whose constructor logs some messages when called, using @info
and potentially @warn
. This is useful to me when I need to check in the log what parameters I actually used in some of my computations.
However, in some other part, I need to initialize this structure but with default values, for which I do not need to see such logging message. Is there a way to achieve this ?
At the moment my strategy is the following:
let initialized_var
with_logger(NullLogger()) do
initialized_var = init_var()
end
end
The let is to ensure initialized_var
is known outside of the with_logger...
block. Is it possible to avoid this kind of structure ?