fix(deps): update dependency tslog to v5#652
Open
renovate[bot] wants to merge 1 commit into
Open
Conversation
Contributor
Test Results 8 files - 2 1 100 suites - 34 2m 5s ⏱️ - 10m 38s Results for commit 7730ff9. ± Comparison against base commit cc6e2fa. This pull request removes 193 tests.♻️ This comment has been updated with latest results. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
4.11.0→5.0.0Release Notes
fullstack-build/tslog (tslog)
v5.0.0Compare Source
A ground-up rewrite. tslog is now ESM-only, zero-dependency, Node >=20, and built with TypeScript 7 / ES2022. Settings are grouped, JSON output is fields-first, and the logger gains a middleware pipeline, async transports, JSONPath masking, OpenTelemetry/pino/GenAI presets, ready-made file/http/ringbuffer/worker transports, and tree-shakeable subpath modules. v5 also adds first-class support for agents and LLMs — fields-first calls, agent/session correlation, and OTel-GenAI attributes; OpenClaw uses tslog for its agent logging. This is a breaking release — see MIGRATION_v4_to_v5.md for the upgrade path.
Added
pretty,json,mask,stack, andmetagroups instead of a flat list ofprettyLog*/maskValues*keys. Sub-loggers merge groups rather than overwrite them.info(fields, message?, ...args)as well asinfo(message, ...args). A single object spreads its fields to the top level, a leading object plus string spreads fields and setsmessage, and positional args land undermessage/"1"/… Runtime metadata moves under_logMetacarrying av: 5schema marker. All JSON keys are configurable via thejsongroup.logger.use(middleware)runs functions over each log context to mutatelogObj/metaor drop the log entirely (returnnull/false).attachTransport()returning a detach function,logger.flush(), andSymbol.asyncDispose/Symbol.disposesupport (await using). Each transport may declare its ownminLevelandformat("pretty","json", or a custom formatter).mask.paths(JSONPath-ish patterns such asuser.passwordor*.token),mask.regex, and amask.censorof"remove","hash", a string, or a function (withmask.hashLabel).tslog/presets/pino(pinoFormat,pinoTransport,toPinoLevel),tslog/otel(otelFormat,toOtelRecord,levelToSeverityNumber,OtelSeverityNumber,otelTraceContext,stringifyOtelRecord), andtslog/presets/genai(genai,genaiAttributes,genaiSummaryemitting OTelgen_ai.*fields).tslog/transports/file(fileTransport, non-blocking, flush/dispose),tslog/transports/http(httpTransport, batched),tslog/transports/ringbuffer(ringBufferTransportwith.dump()/.clear()), andtslog/transports/worker(workerTransport, Node-only off-thread sink I/O).tslog/serializersexportsstdSerializers(err,req,res,user), the individual serializers, and aserialize(map)middleware helper.runInContext(ctx, fn)uses AsyncLocalStorage to attach context fields to_logMetawhenmeta.attachContextis enabled. Auto-resolves on Node/Deno/Bun; on Cloudflare Workers inject one via thecontextStoragesetting (graceful no-op in browsers, with a one-time development warning).customLevelssetting andlog(levelId, levelName, ...args).child()(alias ofgetSubLogger()),isLevelEnabled(),getContext(),addLevel(),logger.if(condition),Logger.fromEnv(),defineConfig(), andTslogConfigError(thrown whenstrictConfigis on).tslog/lite(minimal console wrappers preserving native line numbers),tslog/cli(also thetslogbin, an NDJSON pretty-printer for stdin),tslog/testing(createTestLogger,mockLogger),tslog/throttle(rate-limit middleware),tslog/pretty/box(box,tree), andtslog/console(wrapConsole,restoreConsole,isConsoleWrapped).typeis omitted, output isprettyeverywhere (server, CI, browser, React Native); only the coloring adapts to the environment: colored on an interactive TTY (CSS in the browser) and uncolored when stdout is piped/redirected/CI, so no ANSI escapes leak into files or log collectors. Structured JSON is opt-in viatype: "json",TSLOG_TYPE=json, or a JSON transport.NO_COLORstrips colors without switching the format;FORCE_COLORforces styled pretty. Applies to bothnew Logger()and the ready-madelog.navigator.product(_logMeta.runtime: "react-native", Hermes engine version when available), Hermes/JSC stack frames parsed with a hybrid parser, pretty output by default._logMeta.hostnameresolves fromHOSTNAME/HOST/COMPUTERNAME, then the OS hostname (Deno.hostname()/node:osviaprocess.getBuiltinModule), instead of defaulting to"unknown".sideEffects: false(audited) with per-runtime conditional exports.tslog/slim— the smallest structured-JSON build (~9KB gzip vs ~19KB for the full browser entry, budget-checked in CI): the same pipeline minus masking, pretty output, and stack capture;masksettings andtype: "pretty"throw instead of silently degrading.type: "json"lines through a batchedprocess.stdout.write(one write per event-loop turn, early flush past ~8KB) instead of per-lineconsole.log; drained bylogger.flush(),await using, and guardedbeforeExit/exithooks (a bareprocess.exit()loses nothing). Browser/universal entries keepconsole.log.clock: () => Date(deterministic tests, offset/monotonic stamping; inherited by sub-loggers, hostile clocks ignored) andjson.time: "iso" | "epoch" | false | fncontrolling the top-level timestamp representation (_logMeta.datestays UTC ISO).createTestLogger(settings, { now, normalize }):nowfreezes only that logger's clock (no fake-timer sledgehammer),normalize: trueyields snapshot-stable records/lines; plus a standalonenormalizeMeta(recordOrLine)scrubber (all intslog/testing).tslog/otel—otlpFormat/toOtlpJson/toOtlpLogRecord/toOtlpAnyValue/stringifyOtlpRequestemit the collector wire format (camelCase proto3 fields, typed attributes,resourceLogs[].scopeLogs[].logRecords[]envelope,exception.*semconv mapping for logged errors), andotlpBatchBodypairs with the http transport's newencodeBodyoption to POST merged batches straight to/v1/logs.httpTransport({ encodeBody })— custom body encoder for endpoints whose payload is neither NDJSON nor a JSON array (used by the OTLP pairing above).logger.if(condition)returns the logger when the condition is truthy and a no-op stand-in when falsy, so a per-call guard reads as a fluent chain (log.if(!ok).warn("failed", { id })). UseisLevelEnabled()to skip expensive payload construction.pretty.passObjectsNativelyhands non-Errorarguments to the console by reference (on by default in real browsers), so DevTools renders collapsible, interactive trees; pair withpretty.levelMethodfor native warn/error stack groups. Setfalsefor log-time snapshots or text-matchable console output.Errorstack frames resolve through discoverable source maps back to original.tsfile/line/column (automatic outside production; override withTSLOG_SOURCE_MAPS=on/off).Changed
console.log(see the buffered stdout sink above) — code interceptingconsole.logmust spy onprocess.stdout.writeor usetype: "hidden"plus a transport.tslog/otelresource precedence — intoOtelRecord,resourceattributes now win over colliding per-record fields (resource identity semantics); in the OTLP shape they live in the envelope, separate from record attributes._logMeta.v: 5;name/parentNamesappear only when set (no"[undefined]"noise).mask.keysstarts empty; enable it explicitly.Removed
require("tslog")— the package is ESM-only.overwrite.*hooks (mask,toLogObj,addMeta,formatMeta,formatLogObj,transportFormatted,transportJSON,addPlaceholders) — use middleware and per-transportformatinstead.prettyLogTemplate/prettyError*/prettyLog*,stylePrettyLogs,maskValuesOfKeys/maskValuesRegEx/maskPlaceholder,metaProperty, andstackDepthLevel(now thecallerFrameconstructor parameter).hideLogPositionForProduction— superseded by thestackgroup and env-aware defaults.loggerEnvironment/createLoggerEnvironmentsingleton — each entry point exports its own environment factory (createNodeEnvironment,createBrowserEnvironment,createUniversalEnvironment/selectEnvironment).{"0": message}JSON shape.Fixed
URLvalues now render correctly instead of as empty objects; caller-frame detection no longer over-matches internal frames; the pino fields-first overload no longer collides with the string-first signature; and bareErrorarguments preserve theircausechain instead of dropping it./@​fs/C:/…), so log positions resolve correctly on Windows instead of being truncated to/@​fs/C. (#323, #302)Configuration
📅 Schedule: (in timezone America/New_York)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Never, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.