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.
Basic Usage
Available Placeholders
Examples
Minimal Format
Branded line with {icon} and {service}
Use {icon} for the Logixlysia fox (level styling applies when colors and a TTY are available). Pair with service in config:
useColors: false or non-TTY output, a line can look like:
β‘ slow via {speed} when duration β₯ verySlowThreshold (default 1000).
Status text
404 Not Found, 500 Internal Server Error.
Timestamp Format
Configure timestamp format separately:Context tree
WhenshowContextTree 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
ERRORlogs, anerrorrow is appended when an error object is present (parsed message). - Set
contextDepth(default1) to flatten nested objects into dotted keys (e.g.user.id) up to that depth.
β¦ GET /orders 500 3ms Checkout failed:
Structured Error Logs
Logixlysia natively supports structured errors (similar to theevlog pattern) when thrown exceptions contain specific troubleshooting fields:
why: Explains the root cause of the error.fix: Suggests actionable remediation.link: Provides a URL to documentation or troubleshooting help.internal: Log-safe diagnostic metadata (e.g. error codes, non-sensitive context).
error. namespace (error.why, error.fix, error.link, and error.internal) as individual tree branches.
[!WARNING]
Because error.internal is emitted verbatim to logs, it should contain only log-safe diagnostic metadata. Do not place sensitive secrets, credentials, or PII (Personally Identifiable Information) in this field.
showContextTree: false to disable the tree and put stringified context back on the main line via {context} when you include that token.
Error Log Formatting
ThecustomLogFormat 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.
Best Practices
- Keep formats concise for readability
- Include essential information only
- Use consistent formatting across environments
- Consider log parsing requirements when designing formats
- Error logs will include the error message in the
{message}placeholder