Customize log message formats using placeholders to match your logging needs.
If you omit customLogFormat, Logixlysia uses a built-in default that includes the fox {icon}, optional {service} prefix, colored method and duration, {speed} for slow requests, and other common fields.
Request duration (e.g. 12ms, 1.5s); with colors, green / yellow / red based on slowThreshold and verySlowThreshold
{method}
HTTP method (padded in the default format)
{pathname}
Request path (alias: {path}); includes query string if logQueryParams is enabled
{query}
Raw query string (e.g. ?id=123)
{status}
Response status code
{statusText}
Status text from Nodeβs http.STATUS_CODES (e.g. Not Found for 404)
{message}
Custom message
{icon}
Logixlysia fox π¦; plain emoji when useColors is off or output is not a TTY; with colors on a TTY, a level-colored background around the fox (green INFO, yellow WARNING, red ERROR, blue DEBUG)
{speed}
When duration β₯ verySlowThreshold, appends β‘ slow (yellow with colors)
{service}
From config.service, rendered as [name] (dim with colors); empty if unset
{context}
JSON string of data.context when the context tree is off or context is empty; omitted on the main line when the context tree is shown (see below)
{ip}
Client IP address (from x-forwarded-for or x-real-ip; empty when testing locally without these headers)
With useColors: false or non-TTY output, a line can look like:
2025-04-13T15:00:19.123Z [my-api]π¦ GET /api/users 200 12ms User viewed profile
On a color terminal, the fox appears inside a colored chip by level, and slow requests append β‘ slow via {speed} when duration β₯ verySlowThreshold (default 1000).
When showContextTree is true (default), object context passed to logger.info / warn / error / debug is printed under the main line as tree branches, instead of being inlined into {context} on that line.
Each row is two spaces, ββ or ββ, the key (cyan when colors are on), two spaces, then the value.
For ERROR logs, an error row is appended when an error object is present (parsed message).
Set contextDepth (default 1) to flatten nested objects into dotted keys (e.g. user.id) up to that depth.
The customLogFormat applies to both regular access logs and error logs. When an error occurs (like validation errors or exceptions), the same formatting rules apply, ensuring consistent log output across all log levels.