@cognitiveproof/softbinding-api-plugin-pino-logger
v1.0.0
Published
Pino structured logging plugin for the C2PA Soft Binding Resolution API server
Readme
@cognitiveproof/softbinding-api-plugin-pino-logger
Pino LoggerPlugin for @cognitiveproof/softbinding-api-server — the C2PA Soft Binding Resolution API server.
Replaces the server's built-in console JSON logger with Pino — a very low-overhead structured logger. createServer() uses this logger for request logging ({ method, path, status, durationMs } per request) and for error reporting in the global error handler.
Install
npm install @cognitiveproof/softbinding-api-server @cognitiveproof/softbinding-api-plugin-pino-loggerUsage
import { createServer } from '@cognitiveproof/softbinding-api-server';
const app = createServer({
logger: '@cognitiveproof/softbinding-api-plugin-pino-logger',
});Or pass the package name via the LOGGER_PLUGIN environment variable and omit the logger option entirely.
To pass options (instead of relying on LOG_LEVEL), import and call the plugin directly:
import { createServer } from '@cognitiveproof/softbinding-api-server';
import createPinoLogger from '@cognitiveproof/softbinding-api-plugin-pino-logger';
const app = createServer({
logger: createPinoLogger({ level: 'debug' }),
});Configuration
| Option | Env var | Default | Description |
| ------- | ----------- | ------- | -------------------------------------------------------------------------------- |
| level | LOG_LEVEL | info | Minimum log level (fatal, error, warn, info, debug, trace, silent) |
