@opentelemetry/api-logs
Public logs API for OpenTelemetry
Last updated a year ago by pichlermarc .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @opentelemetry/api-logs 
SYNC missed versions from official npm registry.

OpenTelemetry Logs Bridge API for JavaScript

NPM Published Version Apache License

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

This package provides everything needed to interact with the unstable OpenTelemetry Logs Bridge API, including all TypeScript interfaces, enums, and no-op implementations. It is intended for use both on the server and in the browser.

Note: This module defines a log backend API. The API is not intended to be called by application developers directly. It is provided for logging library authors to build log appenders, which use this API to bridge between existing logging libraries and the OpenTelemetry log data model.

Alpha Software - Use at your own risk

The Logs Bridge API is considered alpha software and there is no guarantee of stability or long-term support. When the API is stabilized, it will be made available and supported long-term in the @opentelemetry/api package and this package will be deprecated.

Quick Start

Purposefully left blank until SDK is available.

Version Compatibility

Because the npm installer and node module resolution algorithm could potentially allow two or more copies of any given package to exist within the same node_modules structure, the OpenTelemetry API takes advantage of a variable on the global object to store the global API. When an API method in the API package is called, it checks if this global API exists and proxies calls to it if and only if it is a compatible API version. This means if a package has a dependency on an OpenTelemetry API version which is not compatible with the API used by the end user, the package will receive a no-op implementation of the API.

Advanced Use

API Methods

If you are writing an instrumentation library, or prefer to call the API methods directly rather than using the register method on the Tracer/Meter/Logger Provider, OpenTelemetry provides direct access to the underlying API methods through the @opentelemetry/api-logs package. API entry points are defined as global singleton objects trace, metrics, logs, propagation, and context which contain methods used to initialize SDK implementations and acquire resources from the API.

const api = require("@opentelemetry/api-logs");

/* A specific implementation of LoggerProvider comes from an SDK */
const loggerProvider = createLoggerProvider();

/* Initialize LoggerProvider */
api.logs.setGlobalLoggerProvider(loggerProvider);
/* returns loggerProvider (no-op if a working provider has not been initialized) */
api.logs.getLoggerProvider();
/* returns a logger from the registered global logger provider (no-op if a working provider has not been initialized) */
const logger = api.logs.getLogger(name, version);

// logging a log record in a log appender
logger.emit({ severityNumber: SeverityNumber.TRACE, body: 'log data' });

Useful links

License

Apache 2.0 - See LICENSE for more information.

Current Tags

  • 0.54.2                                ...           latest (8 days ago)
  • 0.34.0                                ...           next (2 years ago)

33 Versions

  • 0.54.2                                ...           8 days ago
  • 0.54.1                                ...           10 days ago
  • 0.54.0                                ...           23 days ago
  • 0.53.0                                ...           3 months ago
  • 0.52.1                                ...           5 months ago
  • 0.52.0                                ...           5 months ago
  • 0.51.1                                ...           6 months ago
  • 0.51.0                                ...           7 months ago
  • 0.50.0                                ...           7 months ago
  • 0.49.1                                ...           9 months ago
  • 0.49.0                                ...           9 months ago
  • 0.48.0                                ...           10 months ago
  • 0.47.0                                ...           10 months ago
  • 0.46.0                                ...           a year ago
  • 0.45.1                                ...           a year ago
  • 0.45.0                                ...           a year ago
  • 0.44.0                                ...           a year ago
  • 0.43.0                                ...           a year ago
  • 0.42.0                                ...           a year ago
  • 0.41.2                                ...           a year ago
  • 0.41.1                                ...           a year ago
  • 0.41.0                                ...           a year ago
  • 0.40.0                                ...           a year ago
  • 0.39.1                                ...           2 years ago
  • 0.39.0                                ...           2 years ago
  • 0.38.0                                ...           2 years ago
  • 0.37.0                                ...           2 years ago
  • 0.36.1                                ...           2 years ago
  • 0.36.0                                ...           2 years ago
  • 0.35.1                                ...           2 years ago
  • 0.35.0                                ...           2 years ago
  • 0.34.0                                ...           2 years ago
  • 0.33.0                                ...           2 years ago

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