Including a variable outside a function in a log message

No. If my_calculation isn’t given case.id somehow then it just has no access. If you can’t change that, you could @warn in main instead; you just need my_calculation to indicate something went wrong, like returning an indicator output (NaN, nothing) for main to check (isnan, isnothing) or throwing an error for main to handle (try catch finally).

2 Likes