Conversation
36287c0 to
b04986c
Compare
| level: Logger.Level, | ||
| message: Logger.Message, | ||
| metadata: Logger.Metadata?, | ||
| source: String, | ||
| file: String, | ||
| function: String, | ||
| line: UInt |
There was a problem hiding this comment.
Why are some of these unused?
There was a problem hiding this comment.
Because this logger is used to write plain output to the console on stderr.
Later if we want to get fancy we can add more configurability over the log message structure and then plumb that to CLI options but for now I want to be able to do log.error("foo") from somewhere in the CLI code and see:
fooin errs when I run container somecommand 2> errs and it hits that log statement.
| /// Basic log handler for where simple message output is needed, | ||
| /// such as CLI commands. | ||
| public struct StderrLogHandler: LogHandler { | ||
| public var logLevel: Logger.Level = .info |
There was a problem hiding this comment.
should the default here be ".error"?
There was a problem hiding this comment.
No, we want to be able to write stuff at different levels to stderr, not just log.error().
When we plumb out --debug, the logger will be configured with logLevel .debug when the flag is enabled.
--debug. #507. The--debugoption can set the logging level appropriately, and CLI commands can just uselog.debug().Type of Change