Writes structured records through a shared Handler.
Logger instances are lightweight. Use child for a component below the current name, withFields for fields shared by later records, and detached for an independent full name.
Do not add bearer tokens, private keys, or other secrets as fields. Text handlers inspect ordinary objects, and JSON handlers only redact values that define a safe customJson method.
Returns a concise representation for text inspection.
Returns a JSON-safe value for logs.
Creates a logger.
Most applications should use resolveLogger. A logger without a handler uses noopHandler.
Returns the log handler.
Returns the full logger name.
Returns a JSON-safe value for logs.
Writes a debug record. Set withTrace to add a call-site trace.
Optionalargs: ArgumentOptionalwithTrace: booleanReturns a logger with an independent full name.
The new logger uses the same handler but does not inherit this logger's
fields. It keeps additionalArguments by reference. Later changes to that
object change fields written by the detached logger.
Writes an error record. Set withTrace to add a call-site trace.
Optionalargs: ArgumentOptionalwithTrace: booleanWrites an informational record. Set withTrace to add a call-site trace.
Optionalargs: ArgumentOptionalwithTrace: booleanWrites a record at an explicit level.
If withTrace is absent, this method does not add a call-site trace. It
does not use traceByDefault. The named-level methods use that
default when withTrace is absent.
Writes a trace-level record. Set withTrace to add a call-site trace.
Optionalargs: ArgumentOptionalwithTrace: booleanWrites a warning record. Set withTrace to add a call-site trace.
Optionalargs: ArgumentOptionalwithTrace: booleanReturns a logger with additional fields and the same name.
New fields replace existing fields with the same keys. The method copies
only top-level fields. Later top-level changes to the input object do not
change the returned logger, but nested objects and arrays stay shared. The
returned logger inherits this logger's traceByDefault value unless the
traceByDefault argument supplies another value.
OptionaltraceByDefault: boolean
Writes structured records through a shared Handler.
Logger instances are lightweight. Use child for a component below the current name, withFields for fields shared by later records, and detached for an independent full name.
Do not add bearer tokens, private keys, or other secrets as fields. Text handlers inspect ordinary objects, and JSON handlers only redact values that define a safe customJson method.
Example