PrivateconstructorConstructs a Logger.
Minimum weight to emit.
Fields repeated on every line.
Private ReadonlycontextFields repeated on every line.
Private ReadonlythresholdMinimum weight a line must carry to be emitted.
Derives a logger with extra context, sharing this one's threshold.
Fields to add to every line.
The derived logger.
Emits a debug line.
What happened.
Optionaldata: Record<string, unknown>
Structured detail.
PrivateemitWrites one line through the console method matching its level.
Severity of the line.
What happened.
Optionaldata: Record<string, unknown>
Structured detail.
Emits an error line.
What happened.
Optionaldata: Record<string, unknown>
Structured detail.
StaticfromBuilds a logger for the current environment.
Anything carrying an optional LOG_LEVEL. Tolerates null.
Fields to repeat on every line.
A logger honouring the configured (or LOG_LEVEL) threshold.
Emits an info line.
What happened.
Optionaldata: Record<string, unknown>
Structured detail.
Private StaticparseParses a level name, ignoring anything unrecognised.
Optionalvalue: string
The candidate level name.
The level, or null when the value is not one.
Private StaticserializeMakes a data payload serialisable — Error values in particular, which
JSON.stringify would otherwise flatten to {}.
The payload to convert.
The payload with errors expanded to message and stack.
Emits a warn line.
What happened.
Optionaldata: Record<string, unknown>
Structured detail.
Structured, level-classified logging — and nothing else.
Each line is one JSON object emitted through the matching
console.*method, so the runtime's log collector records the native level and keeps the fields searchable. Nothing here aggregates — that is TelemetrySink, a separate capability, because a sink samples at volume and is the wrong place for lines that have to be read back verbatim.Remarks
The threshold comes from the surface registered by configure, and
LOG_LEVELin the environment overrides it per deployment, so staging can run atdebugwithout a code change.Retention is the runtime's business, not this class's — it writes lines and stops there. Whether they are kept, and for how long, is a deployment setting wherever the process runs.
Example
Author
Bayu Dwiyan Satria
Version
1.0.0
Since
1.0.0