Skip to content

Commit 8090978

Browse files
refactor(logging): add _display_path and use in setup_logging!
1 parent 4034f8a commit 8090978

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/globals.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ function _is_headless()::Bool
9393
return haskey(ENV, "CI") || !haskey(ENV, "DISPLAY")
9494
end
9595

96+
function _display_path(file_name)
97+
return _is_headless() ? basename(file_name) : basename(file_name) #abspath(file_name)
98+
end
9699

97100
using Logging
98101
using Logging: AbstractLogger, LogLevel, Info, global_logger
@@ -133,7 +136,8 @@ function setup_logging!(verbosity::Int, logfile::Union{String,Nothing}=nothing)
133136
combined_logger = TeeLogger(console_logger, file_logger)
134137
global_logger(TimestampLogger(combined_logger))
135138
catch e
136-
@warn "Failed to set up file logging to $logfile: $e"
139+
@warn "Failed to set up file logging to $(_display_path(logfile)): $e"
140+
137141
global_logger(TimestampLogger(console_logger))
138142
end
139143
end

0 commit comments

Comments
 (0)