@sophonz/instrumentation-console
v0.0.7
Published
Readme
@sophonz/instrumentation-console
OpenTelemetry instrumentation for console API (log, info, warn, debug) on browsers and Node.js.
Part of the Sophonz OpenTelemetry suite.
Install
bun add @sophonz/instrumentation-console
# or
pnpm add @sophonz/instrumentation-console
# or
npm install @sophonz/instrumentation-consoleUsage
import { SophonzConsoleInstrumentation } from '@sophonz/instrumentation-console';
const instrumentation = new SophonzConsoleInstrumentation({
screenNameOption: { /* optional */ }
});
instrumentation.enable();
// Now console.log, console.info, console.warn, console.debug are instrumented
console.log('Hello', { userId: 123 });API
SophonzConsoleInstrumentation- Main instrumentation class extendingInstrumentationBaseSophonzConsoleInstrumentationConfig- Configuration interfacebetaMode?: boolean- Enable beta featuresloggerOptions?: { baseUrl?: string; service?: string }- Logger configurationcontextManager?: ContextManager- Custom context managerscreenNameOption?: ScreenNameOption- Screen name detection options
Peer dependencies
@opentelemetry/api@opentelemetry/instrumentation
License
See LICENSE in this package.
Part of sophonz-js.
