@opentelemetry/sdk-logs
OpenTelemetry logs SDK
Last updated 3 years ago by pichlermarc .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @opentelemetry/sdk-logs 
SYNC missed versions from official npm registry.

OpenTelemetry Logs SDK

NPM Published Version Apache License

Note: This is an experimental package under active development. New releases may include breaking changes.

OpenTelemetry logs module contains the foundation for all logs SDKs of opentelemetry-js.

Used standalone, this module provides methods for manual instrumentation of code, offering full control over recording logs for client-side JavaScript (browser) and Node.js.

It does not provide automated instrumentation of known libraries or host environment logs out-of-the-box.

Installation

npm install --save @opentelemetry/api-logs
npm install --save @opentelemetry/sdk-logs

Usage

The basic setup of the SDK can be seen as followings:

const logsAPI = require('@opentelemetry/api-logs');
const {
  LoggerProvider,
  SimpleLogRecordProcessor,
  ConsoleLogRecordExporter,
} = require('@opentelemetry/sdk-logs');

// To start a logger, you first need to initialize the Logger provider.
const loggerProvider = new LoggerProvider();
// Add a processor to export log record
loggerProvider.addLogRecordProcessor(
  new SimpleLogRecordProcessor(new ConsoleLogRecordExporter())
);

//  To create a log record, you first need to get a Logger instance
const logger = loggerProvider.getLogger('default');

// You can also use global singleton
logsAPI.logs.setGlobalLoggerProvider(loggerProvider);
const logger = logsAPI.logs.getLogger('default');

// emit a log record
logger.emit({
  severityNumber: logsAPI.SeverityNumber.INFO,
  severityText: 'INFO',
  body: 'this is a log record body',
  attributes: { 'log.type': 'LogRecord' },
});

Config

Logs configuration is a merge of both the user supplied configuration and the default configuration as specified in config.ts

Example

See examples/logs

Useful links

License

Apache 2.0 - See LICENSE for more information.

Current Tags

  • 3.0.0-rc.0                                ...           canary (a month ago)
  • 3.1.0                                ...           latest (22 days ago)

65 Versions

  • 3.1.0                                ...           22 days ago
  • 3.0.0                                ...           a month ago
  • 3.0.0-rc.0                                ...           a month ago
  • 0.223.0                                ...           2 months ago
  • 0.300.0-development.1                                ...           2 months ago
  • 0.300.0-development.0                                ...           2 months ago
  • 0.222.0                                ...           3 months ago
  • 0.222.0-development.0                                ...           3 months ago
  • 0.221.0                                ...           4 months ago
  • 0.220.0                                ...           5 months ago
  • 0.219.0                                ...           6 months ago
  • 0.218.0                                ...           6 months ago
  • 0.217.0                                ...           7 months ago
  • 0.216.0                                ...           7 months ago
  • 0.215.0                                ...           7 months ago
  • 0.214.0                                ...           8 months ago
  • 0.213.0                                ...           9 months ago
  • 0.212.0                                ...           10 months ago
  • 0.211.0                                ...           10 months ago
  • 0.210.0                                ...           10 months ago
  • 0.209.0                                ...           a year ago
  • 0.208.0                                ...           a year ago
  • 0.207.0                                ...           a year ago
  • 0.206.0                                ...           a year ago
  • 0.205.0                                ...           a year ago
  • 0.204.0                                ...           a year ago
  • 0.203.0                                ...           a year ago
  • 0.202.0                                ...           a year ago
  • 0.201.1                                ...           2 years ago
  • 0.201.0                                ...           2 years ago
  • 0.200.0                                ...           2 years ago
  • 0.200.0-rc.1                                ...           2 years ago
  • 0.200.0-dev.1                                ...           2 years ago
  • 0.200.0-dev.0                                ...           2 years ago
  • 0.57.2                                ...           2 years ago
  • 0.57.1                                ...           2 years ago
  • 0.57.0                                ...           2 years ago
  • 0.56.0                                ...           2 years ago
  • 0.55.0                                ...           2 years ago
  • 0.54.2                                ...           2 years ago
  • 0.54.1                                ...           2 years ago
  • 0.54.0                                ...           2 years ago
  • 0.53.0                                ...           2 years ago
  • 0.52.1                                ...           2 years ago
  • 0.52.0                                ...           2 years ago
  • 0.51.1                                ...           3 years ago
  • 0.51.0                                ...           3 years ago
  • 0.50.0                                ...           3 years ago
  • 0.49.1                                ...           3 years ago
  • 0.49.0                                ...           3 years ago
  • 0.48.0                                ...           3 years ago
  • 0.47.0                                ...           3 years ago
  • 0.46.0                                ...           3 years ago
  • 0.45.1                                ...           3 years ago
  • 0.45.0                                ...           3 years ago
  • 0.44.0                                ...           3 years ago
  • 0.43.0                                ...           3 years ago
  • 0.42.0                                ...           3 years ago
  • 0.41.2                                ...           3 years ago
  • 0.41.1                                ...           3 years ago
  • 0.41.0                                ...           3 years ago
  • 0.40.0                                ...           3 years ago
  • 0.39.1                                ...           4 years ago
  • 0.39.0                                ...           4 years ago
  • 0.37.0                                ...           4 years ago

© 2010 - cnpmjs.org x YWFE | Home | YWFE