logixlysia@6.14.0
Minor Changes
-
36b8d61: A handler that calls
log.info,log.warn,log.debugorlog.errornow gets its access line as well. Before, the custom line replaced the access line, so the request’s status and full duration were logged nowhere, and the text line printed200even when the handler went on to return a 404.The custom line is written before the response exists. It shows
-where the status goes in the text and file formats, and has nostatusin the JSON line or in transport records. The access line follows with the real status, the fulldurationMs, the response-phase enricher fields and any AI usage merged during the request.A request that logs once now writes two lines instead of one. To add fields to the access line without a second line, use
log.mergeContext. To drop the access line, setlogFilter.accessLine. -
df74ccb: Make the console context tree easier to scan.
contextDepthnow defaults to2, so a nested object prints its fields asuser.id usr_123rows in place of one JSON blob. SetcontextDepth: 1to get the old output.- On a TTY, a context string longer than 200 characters is cut to 200 and ends in
… (<length> chars). Piped stdout, files and transports still get the whole string.
-
9f03ff3: The plugin now runs on the Elysia 2 prereleases (
2.0.0-beta.32and later) as well as on Elysia 1.4, and theelysiapeer range accepts both. On Elysia 2 it mounts with the scope 2.x namesplugin, reads a handler’s result fromresponseValue, recognises astatus()result by its new shape, times ansse()body that Elysia hands over before its first read, keeps one instance’s logger and pino out of a sibling instance’s state, and gives the plugin instance astoresoplugin.store.pinostill works. A validation error’sfailedPathsstay JSON Pointers on both lines, andlogErrorPayloadlogs the payload Elysia 2 no longer puts in the message. The types still describe Elysia 1.4. -
75c305f: Each line in the
logFilePathfile now starts with a full ISO 8601 UTC timestamp and carries the response status, as the file logging docs describe. A line reads2025-04-13T15:00:19.225Z INFO GET /api/users 200 123.45ms message {"context":"json"}, where it wasINFO 123.45ms GET /api/users message. A line you write withlog.info()shows-for the status, and its context is written after the message. The layout of the file changed, so update any script that parses it. -
94c74ce: The JSON console line now carries the
serviceoption as aservicekey, placed afterlevel. Before,serviceonly reached the text line’s[name]prefix, so records from several services could not be told apart once they were collected in one place. A record without a configured service is unchanged. -
c57049a:
preset: 'prod'andpreset: 'json'now print one line of JSON per record, as the docs promised, instead of the text line with its fox emoji. Loki, Datadog and CloudWatch can parse the console output without extra config:{"timestamp":"2026-11-12T05:43:59.800Z","level":"INFO","message":"","request":{"method":"GET","url":"http://localhost/users/[REDACTED]"},"status":200,"durationMs":0.83,"context":{"requestId":"8623487f-c151-4ccb-ae83-3d708e541e39"}}The line is the record transports receive, with an ISO-8601
timestamp. Newlines in values are escaped, andautoRedactmasks it as it masks the text line. A new option,consoleFormat: 'text' | 'json', picks the console output and works without a preset.What changed for you: if you use
prodorjsonand want the text line back, setconsoleFormat: 'text':logixlysia({ preset: 'prod', config: { consoleFormat: 'text' } })The default (no preset) and
preset: 'dev'print exactly what they did before. Plain records also serialise faster for every adapter, since they skip the per-value replacer that BigInt, Error, Map, Set and cycles need. -
da54dc5: Print the log level as a word when console colors are off. With
useColors: falseor a stdout that is not a TTY, the{icon}token in the default line now readsDEBUG,INFO,WARNorERROR, padded to five characters so the method column lines up, in place of the🦊emoji that looked the same for every level. A color terminal still shows the fox in a level-colored chip. -
6392023:
logFilternow takesincludeandexcludeglobs on the request pathname, so health checks, metrics and static assets can stay out of your logs, or only/api/**can be logged. A request that matchesexclude, or misses a non-emptyinclude, writes nothing: no access line, nolog.*lines from its handler, no error line and no WebSocket lines for its path.excludewins overinclude. The globs are the onessampling.tail.pathsalready uses, they are compiled once at startup, and a value that is not an array of non-empty glob strings throws an error naming the key. An excluded request skips log assembly, redaction and enrichers, so it costs a fraction of a logged one. -
573dc2d: Shorten the console line on a terminal and stop printing an error message twice.
- When stdout is a TTY and you set neither
timestampnorcustomLogFormat,{now}prints localHH:MM:ss.SSS(09:05:07.042) in place of the full ISO date. Piped output, CI and Docker logs keep the ISO timestamp, and anytimestamporcustomLogFormatyou set keeps working as before. - A failed request no longer repeats its message as an
errorrow in the tree when the main line already ends with it. The row still appears when your format leaves out{message}or the logged message differs from the error’s.
- When stdout is a TTY and you set neither
Patch Changes
- b927e60: Show the
causechain of a logged error in the console. Each cause prints under the error asCaused by: <name>: <message>, up to three levels deep, with the same redaction as the error message. Transports already received the cause and are unchanged. - 4e44611: Make
autoRedactcheaper on every request. A request URL with no userinfo, query, fragment or escape is checked as text and parsed only when part of it would change, and the answer to whether a field name is sensitive is kept per name. The redacted output is the same. A request through theprodpreset takes about a fifth less time. - b9e6a69: Honor the
NO_COLORenvironment variable. When it is set to a non-empty value, the console line is printed without colors on an interactive terminal too, as it is withuseColors: false, and the pino pretty stream stops colorizing. - 25f3c9d: Importing the plugin no longer loads
chalk. It loads when a text logger is created on a terminal, so a server without one, or one that logs JSON, never pays for it. Colors, and when they turn on, are unchanged. Measured on the built package after Elysia is loaded: 19.2 ms to 14.3 ms under Bun, 14.0 ms to 8.1 ms under Node. On Node before 22.12, which cannotrequirean ES module, terminal lines are no longer colored. - 3f962fa: Import logixlysia faster and install a smaller package.
pinoandpino-prettynow load the first time something needs them, so a config withoutconfig.pinoand withoutstore.pinouse never pays for them.store.pinoandcreateLoggerbehave as before, and an app bundled withbun build,bun build --compile, esbuild or Vite still contains pino. The published files no longer embed inline sourcemaps, which cuts the packed tarball from about 233 kB to about 79 kB. - c7ae0b3: Importing the plugin is cheaper. It no longer loads
node:httpfor the status reason phrases, and it loadsnode:zlibonly when a rotated log file is compressed. Measured on the built package after Elysia is loaded: 30.5 ms to 18.6 ms under Bun, 27.4 ms to 13.2 ms under Node. - 5180e0c:
logis now defined in handlers of an app that mounts logixlysia through a shared setup plugin (new Elysia({ name: 'setup' }).use(logixlysia())), at any depth. Before, TypeScript showedlogbut the handler threwundefined is not an objectand the request answered 500. The same holds forgroupandguardroutes,onErrorhandlers andws.data.login WebSocket handlers. A module that mounts its own instance still gets that instance’slog, and each request is still logged once. - b10b6a3: The README quick start now shows logging from a handler with
({ log })and the output it prints, and links the agent skill the repo ships. - b765685: An AI stream that the client cancels after reading its finish chunk is recorded with its usage and finish reason, instead of leaving no trace. A cancel before the finish chunk still records nothing.
- 9552618: Redact a card number written one digit at a time, such as
4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1, and a card that follows another number, such asid 12 4111 1111 1111 1111. Both were left in the log before. - b24497d: With
autoRedacton, whichpreset: 'prod'turns on, each log line costs less CPU. Request headers are redacted only when the log format prints one (the{ip}token). The built-in patterns skip text that cannot contain a match. What gets redacted is unchanged. - fb0d3c2:
useLogger()now prints one warning to stderr the first time it falls back to a logger that writes nothing because the plugin was created withoutuseAsyncLocalStorage: true. The warning names the option. It never prints in production (NODE_ENV === 'production') or when any plugin has the option on. The fallback logger behaves as before.