mirror of
https://github.com/iv-org/invidious.git
synced 2025-11-04 14:41:59 +00:00
Logger: Add color support for different log levels (#4931)
No related issue
This commit is contained in:
@@ -122,6 +122,9 @@ Kemal.config.extra_options do |parser|
|
||||
parser.on("-l LEVEL", "--log-level=LEVEL", "Log level, one of #{LogLevel.values} (default: #{CONFIG.log_level})") do |log_level|
|
||||
CONFIG.log_level = LogLevel.parse(log_level)
|
||||
end
|
||||
parser.on("-k", "--colorize", "Colorize logs") do
|
||||
CONFIG.colorize_logs = true
|
||||
end
|
||||
parser.on("-v", "--version", "Print version") do
|
||||
puts SOFTWARE.to_pretty_json
|
||||
exit
|
||||
@@ -138,7 +141,7 @@ if CONFIG.output.upcase != "STDOUT"
|
||||
FileUtils.mkdir_p(File.dirname(CONFIG.output))
|
||||
end
|
||||
OUTPUT = CONFIG.output.upcase == "STDOUT" ? STDOUT : File.open(CONFIG.output, mode: "a")
|
||||
LOGGER = Invidious::LogHandler.new(OUTPUT, CONFIG.log_level)
|
||||
LOGGER = Invidious::LogHandler.new(OUTPUT, CONFIG.log_level, CONFIG.colorize_logs)
|
||||
|
||||
# Check table integrity
|
||||
Invidious::Database.check_integrity(CONFIG)
|
||||
|
||||
Reference in New Issue
Block a user