/tsed:tsed-loggerfrom Ts.ED
Configures logging in Ts.ED v8 apps using @tsed/logger v8. Covers logger injection, request-scoped logs via $ctx.logger, appenders, layouts, JSON logs in production, and troubleshooting common issues like missing appenders or duplicated log lines.
Ships in Ts.ED. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Ts.ED logs through one global Logger instance ($log from @tsed/logger) plus one ContextLogger per request ($ctx.logger). Appenders decide where events go, layouts decide how they look.
Read the appender and layout reference before configuring outputs and the request logging reference before touching the logger configuration key.
@tsed/logger and @tsed/logger-std are dependencies of @tsed/platform-http. A Ts.ED HTTP application already has two appenders on $log: stdout (levels info, debug) and stderr (levels trace, fatal, error, warn), both with the colored layout.$log only has one console appender registered under the name stdout.$log.appenders.set().Use the application logger for lifecycle and background work:
import {Injectable, inject} from "@tsed/di";
import {Logger} from "@tsed/logger";
@Injectable()
export class BillingService {
protected logger = inject(Logger);
$onInit() {
this.logger.info({event: "BILLING_READY"});
}
}
logger() from @tsed/di returns the same instance without a class; @Inject() logger: Logger also works. Do not create new Logger() in application code: it has no appenders and ignores the Ts.ED configuration.
Use the request logger so every line carries reqId, time and duration:
import {Controller} from "@tsed/di";
import {Context} from "@tsed/platform-params";
import {Get} from "@tsed/schema";
@Controller("/orders")
export class OrdersController {
@Get("/")
list(@Context() $ctx: Context) {
$ctx.logger.info({event: "ORDERS_LIST", tenant: $ctx.request.headers["x-tenant"]});
}
}
In a service called during the request, use context().logger.info({...}) (context from @tsed/di) instead of passing $ctx around.
$ctx.logger methods take one argument: an object, or a string (stored as message).logger.maxStackSize, default 30) and flushed when the request ends; error and fatal flush immediately.$log.context.set(...), a shared field, a custom appender state). Concurrent requests overwrite each other.import "@tsed/platform-express";
import "@tsed/platform-log-request";
import {Configuration} from "@tsed/di";
@Configuration({
logger: {
level: "info",
logRequest: true,
ignoreUrlPatterns: ["^/health", /^\/metrics/],
disableRoutesSummary: process.env.NODE_ENV === "production"
}
})
export class Server {}
level accepts debug, info, warn, error, off. The default is info, and off when NODE_ENV=test.import "@tsed/platform-log-request". Without it logRequest does nothing.logger.alterLog(level, obj, $ctx) and logger.onLogResponse($ctx).reqIdBuilder, maxStackSize, format, disableBootstrapLog, debug, perf. See the reference.import {$log} from "@tsed/logger";
import "@tsed/logger-std";
import "@tsed/logger/layouts/JsonLayout.js";
if (process.env.NODE_ENV === "production") {
$log.appenders
.set("stdout", {type: "stdout", levels: ["info", "debug"], layout: {type: "json"}})
.set("stderr", {type: "stderr", levels: ["trace", "fatal", "error", "warn"], layout: {type: "json"}});
}
import "@tsed/logger-std" in the same file: that import resets stdout/stderr to their defaults, so it must run before your set() calls, not after.stdout and stderr to replace the default appenders. Any other name adds an output and duplicates every line; call $log.appenders.delete("stdout") or .clear() first when that is not wanted.levels (plural, array of level names). Omit it to receive every level.colored need an import: @tsed/logger/layouts/JsonLayout.js, BasicLayout.js, MessagePassThroughLayout.js, DummyLayout.js, ObjectLayout.js; pattern needs the @tsed/logger-pattern-layout package.data array.Install, import, then register. Available packages: @tsed/logger-file, -logstash-http, -logstash-udp, -seq, -loggly, -slack, -rabbitmq, -smtp, -insight, -logentries, -connect.
import {$log} from "@tsed/logger";
import {FileAppender} from "@tsed/logger-file";
$log.appenders.set("file", {
type: FileAppender,
filename: "logs/app.log",
pattern: ".yyyy-MM-dd",
levels: ["info", "warn", "error", "fatal"]
});
type: it proves the package is imported and avoids typos in the string name.options; file settings (filename, maxLogSize, backups, pattern) stay at the top level.Extend BaseAppender with @Appender({name}) and implement write(loggingEvent); extend BaseLayout with @Layout({name}) and implement transform(loggingEvent, timezoneOffset). Import the file once before appenders.set(). Templates are in the reference.
Call await $log.shutdown() in the $onDestroy() hook of Server or in the signal handler. File, UDP, SMTP, RabbitMQ and HTTP-batching appenders lose buffered events otherwise. shutdown() also sets the level to OFF.
console.log in application code; it bypasses levels, layouts and request correlation.level: [...] on an appender; the key is levels. level is silently ignored and the appender receives everything.StdoutAppender from the @tsed/logger root; v8 moved them (see step 5).logger.alterLog.type only prints Appender <type> doesn't exists. Check your configuration. and silently falls back to the console appender. An unknown layout prints Missing <name> layout doesn't exists. and falls back to colored. Treat both warnings as errors.@tsed/logger-logstash-udp registers itself under the name logstash-http, not logstash-udp. type: "logstash-udp" falls back to console. Pass type: LogStashUdpAppender, and do not load both logstash packages in one process (the last import wins the name).logger.format rewrites stdout/stderr with the pattern layout; it requires import "@tsed/logger-pattern-layout", and it overrides appenders set earlier under those names.logger.requestFields, logStart and logEnd belong to the deprecated @tsed/platform-log-middleware; @tsed/platform-log-request ignores them.logger.jsonIndentation is forced by NODE_ENV (0 in production, 2 otherwise); setting it has no effect.logger().stop() / level: "off" silences everything, including errors. Tests run with off by default; pass logger: {level: "info"} to PlatformTest.bootstrap() to see logs.console.* and no new Logger() in application code; services use inject(Logger) or context().logger.$ctx.logger only.@tsed/platform-log-request is imported when request logs are expected.type and layout type has its package or layout module imported; startup prints no "doesn't exists" warning.levels, and no line is emitted twice.disableRoutesSummary: true.$log.shutdown() is awaited on exit when a buffering appender is configured.Further reading: https://tsed.dev/docs/logger.md, https://logger.tsed.dev/llms.txt, https://logger.tsed.dev/introduction/getting-started.md, https://logger.tsed.dev/introduction/migrate-to-v8.md.
What SKILL.md sets; muted values are Claude Code's defaults
13 skills in this plugin
/tsed-cliScaffolds Ts.ED v8 projects and generates files with the Ts.ED CLI v7, through its MCP server (tools set-workspace, init-project, list-templates, get-template, generate-file) or the tsed binary (tsed init, generate, template, add, run, update, dev, build). Use when creating a Ts.ED project, adding a controller, service, middleware, model, interceptor, pipe, decorator or custom template, when package.json has a "tsed" key or @tsed/cli, when a .templates/ directory exists, or on errors E_CWD_NOT_SET, E_PROJECT_NOT_INITIALIZED, E_TEMPLATE_UNKNOWN, E_ARGS_INVALID./tsed-configurationConfigure and bootstrap a Ts.ED v8 server - the @Configuration decorator or configuration() on the Server class, PlatformExpress/PlatformKoa/PlatformFastify.bootstrap, server options (mount, middlewares, httpPort, httpsPort, acceptMimes, logger, statics, views, responseFilters, imports), per-platform express/koa/fastify options, and @tsed/config sources (envs, dotenv, json, yaml). Use when editing Server.ts, index.ts or src/config, adding @tsed/config or the extends option, or reading settings with constant(), refValue(), @Constant, @Value or configuration().get()./tsed-controllersWrite Ts.ED v8 HTTP controllers and routes - @Controller paths and nested children, mounting through the `mount` configuration, verb decorators from @tsed/schema, parameter decorators from @tsed/platform-params, typed inputs, response decorators and custom endpoint decorators. Use when adding or fixing a REST endpoint, when a route returns 404 or is shadowed by another route, when @BodyParams/@QueryParams/@PathParams receive a plain object or the wrong type, or when working with @Returns, @Status, @Redirect, @View, @Hidden, @Req/@Res or useDecorators.npx claudepluginhub tsedio/tsed --plugin tsedOther plugins' skills for the same job