New:Microsoft Teams Notifications Are Now Available in Socket.Learn more
Get Started

openspan

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openspan

OpenTelemetry tools

latest
Source
npmnpm
Version
1.0.0-alpha.59
Version published
Weekly downloads
2.5K
86.54%
Maintainers
1
Weekly downloads
 
Created
Source

Telemetry tools

Console

Console provides methods debug, info, warn, and error to log messages with different severity levels.

(message: string, ...values: any[], attributes?: object) => void

Messages are formatted using util.format and writes a structured message to stdout or stderr.

The last argument can be an object with additional attributes to be included in the log entry.

Log entry format:

time: string      # ISO 8601 timestamp
severity: string  # DEBUG, INFO, WARN, ERROR
message: string
attributes: object
context: object   # context passed to the constructor

Example

const console = new Console({ context: 'my-app' })

console.info('Hello, %s!', 'world', { foo: 'bar' })

/*
severity: info
context: my-app
time: 2020-01-01T00:00:00.000Z
message: Hello, world!
attributes:
  foo: bar
*/
import { console } from 'openspan'

console.configure({ level: 'warn' })
console.info('ingnored')

FAQs

Package last updated on 13 Jul 2024

Related posts