Structured logging for NetScript packages, services, workers and jobs, built on
LogTape. Use it to create scoped loggers and to log Hono and
oRPC requests with correlated request IDs and redacted debug input.
Configure the loggers with the specified sinks, filters, and loggers.
withContext
function
functionwithContext(context: Record, callback): T
Run a callback with the given implicit context attached to every log record.
Logger
interface
interfaceLogger
A logger interface providing methods to log messages at different levels.
LogRecord
interface
interfaceLogRecord
A single log record.
LogLevel
type alias
typeLogLevel
The severity level of a LogRecord.
Sink
type alias
typeSink
A function that accepts a log record and writes it somewhere.
Types
Symbol
Kind
Description
LoggerOptions
interface
Options for creating loggers.
LoggingConfig
interface
Logging configuration options accepted by configureLogging.
RequestLogContext
interface
Request context used by the logging middleware.
@netscript/logger/middleware
Symbol
Kind
Description
Logger
interface
Re-export of the root Logger type for consumers that import only the middleware sub-path.
LoggerContextVariables
interface
The logger and requestId values installed on a request context; use it as the Hono variables shape when reading those values downstream.
LoggerMiddlewareRequest
interface
Minimal request contract the middleware reads: headers, method, normalized path, and absolute URL. Consumers meet it when adapting or testing the middleware without a concrete Hono context.
LoggerMiddlewareResponse
interface
Minimal response contract the middleware reads for the downstream HTTP status. Consumers meet it when adapting or testing a middleware context.
LoggerMiddlewareContext
interface
Minimal context accepted by the middleware, combining request and response access with setters for logger and requestId.
LoggerMiddlewareEnv
interface
Hono environment shape whose Variables are LoggerContextVariables; use it as the app or route environment when installing the middleware.
LoggerMiddlewareOptions
interface
Controls skipped paths and request, success, and error log levels. logBody is reserved for a future implementation and currently has no effect.
LoggerMiddlewareNext
type alias
Downstream middleware callback that resolves after the next handler completes.
LoggerMiddleware
type alias
Public request-logging handler signature over LoggerMiddlewareContext and LoggerMiddlewareNext.
injectLogger
function
Stores a supplied Logger under the context's logger variable; use it when composing custom middleware around the package's context contract.
injectRequestId
function
Stores and returns the X-Request-ID header value, or a generated short UUID segment when the header is absent.
loggerMiddleware
function
Creates the full Hono integration: injects a service logger and request ID, skips configured paths, and logs request start, completion, and failure.
requestLoggerMiddleware
function
Creates the lightweight integration that injects a service logger and request ID and logs request receipt before running the downstream handler.
@netscript/logger/orpc
Symbol
Kind
Description
Logger
interface
Re-export of the root Logger type for consumers that import only the oRPC sub-path.
LoggingInterceptorContext
type alias
Request-scoped oRPC context seen by the logging interceptors; the root interceptor forwards it to every procedure interceptor of the same request.
RootLoggingInterceptorOptions
interface
Root-interceptor input containing the request-scoped context and a next callback that accepts replacement options. Consumers meet it when implementing or testing a root logging interceptor.
ClientLoggingInterceptorOptions
interface
Procedure-interceptor input containing the request-scoped context, the procedure input, path, and next callback. Consumers meet it when implementing or testing a client interceptor.
RootLoggingInterceptor
type alias
Root-level interceptor signature that wraps the next interceptor or handler and resolves to its result.
ClientLoggingInterceptor
type alias
Procedure-level interceptor signature that can inspect the procedure input and path before delegating.
LoggingInterceptor
type alias
Union accepted by the plugin's root and client interceptor arrays.
LoggingHandlerOptions
interface
Mutable handler options whose interceptor arrays LoggingPlugin.init creates or appends to. Consumers meet it when initializing the plugin outside the concrete oRPC handler type.
LogLevelConfig
interface
Optional log levels for procedure start, success, client-error, and server-error events.
LoggingPluginOptions
interface
Plugin configuration for service identity, debug behavior, levels, input summaries, skipped paths, extra debug redaction fields (redactFields), and an optional custom logger.
LoggingPlugin
class
oRPC handler plugin that installs a root request interceptor and a procedure interceptor to log request start, completion, and failure, with every line correlated to its own request by requestId.
createLoggingPlugin
function
Constructs a LoggingPlugin; use it as the factory alternative to calling the class constructor directly.
LoggerContext
interface
Logger and generated request ID returned for injection into an oRPC handler context.
createLoggerContext
function
Creates a service-scoped logger with a generated request ID and returns both as a LoggerContext.
Request correlation and debug redaction
Every LoggingPlugin request and procedure line carries the requestId of the request it belongs
to, and request durations are measured from that request's own start, also under concurrent
traffic. The root interceptor passes the ID to procedure interceptors through the request's own oRPC
context (next({ context })), not through state shared across requests. Procedures inside one
batched request share that request's ID.
In debug mode the plugin logs the procedure input and an inputSummary of top-level values. Both
apply the same case-insensitive redaction, replacing sensitive values with [REDACTED]:
Default fragments match by substring: password, token, secret, key, auth,
credential, apikey, sessionid, accesstoken, refreshtoken, jwttoken.
Default exact names match the whole key only: handle and prompt. Exact matching keeps keys
such as handler visible; a key like systemPrompt is not covered by default.
redactFields adds substring fragments on top of the defaults. Pass 'prompt' to also redact
systemPrompt, or a domain field such as 'brief' (which also matches briefing).
Services built with @netscript/service pass the same option through .withRPC({ debug: true, redactFields: ['brief'] }). Redaction runs inside the service's RPC handler, so it covers
service-to-service traffic made under a service identity in the same way as browser calls.