Skip to content

Releases: sensedeep/senselogs

v1.0.7

19 Jun 01:23
Compare
Choose a tag to compare

Minor Patch Release

Changes

  • Update README

See

v1.0.6

18 Aug 04:12
Compare
Choose a tag to compare

Minor Patch Release

Changes

  • Fix case where context is {err: new Error()}

See

v1.0.4

08 Nov 06:41
Compare
Choose a tag to compare

Minor Patch Release

Changes

  • Fix references to process.env for execution in the browser.

See

v1.0.3

30 Mar 23:35
Compare
Choose a tag to compare

Minor Patch Release

Changes

  • Update flag support to prefix flagged properties with FLAG_ by default
  • Make addTraceIds more robust if missing context

See

v1.0.2

27 Dec 05:09
Compare
Choose a tag to compare

Minor Feature Release

Features / Changes

  • Add the addTraceIDs API

Fixes

  • none

Correlation Trace IDs

If you are using AWS Lambda, SenseLogs supports the propagation of trace IDs by simply passing in the lambda event and context parameters. SenseLogs will extract the API Gateway requestId, Lambda requestId and X-Ray trace ID.

log.addTraceIds(event, context)

SenseLogs will map these IDs to a uniform x-correlation-NAME SenseLogs context variables. The following variables are supported:

x-correlation-api — API Gateway requestId
x-correlation-lambda — Lambda requestId
x-correlation-trace — X-Ray X-Amzn-Trace-Id header
x-correlation-extended — AWS extended request ID

SenseLogs will define a special variable 'x-correlation-id' that can be used as a stable request ID. It will be initialized to the value of the X-Correlation-ID header or if not defined, SenseLogs will use (in order) API Gateway request or X-Ray trace ID.

See

v1.0.1

30 Sep 19:48
Compare
Choose a tag to compare

Minor Feature Release

Features / Changes

  • Add non-metric properties to the metrics API

Fixes

  • Change definition of metrics dimensions parameter to be a single dimension array

See

v1.0.0

02 Sep 20:41
Compare
Choose a tag to compare

Major Feature Release

Features / Changes

  • Version 1.0 release
  • Add message and units to metrics API

Fixes

  • none

See

v0.10.0

19 Aug 01:33
Compare
Choose a tag to compare

Major Feature Release

This release is our 1.0 candidate.

Features / Changes

  • Add format option for the SenseLogs constructor
  • Added an assert method and channel
  • Added a channel argument to the metrics() method.

Breaking Changes

  • Removed the prefix constructor option. Replaced by more flexible destination and format options.
  • The console destination will by default use the 'json' format. Use format: 'human' to get the previous output format.
  • Added a channel argument to the metrics method to allow metrics to by dynamically controlled via the LOG_FILTER env var.

Output Format Option

The SenseLogs constructor options have been modified. There is a new format option that manages the output format and the destination option is not overloaded to imply a format.

const log = new SenseLogs({format: 'tsv'})

By default SenseLogs will emit log messages in JSON format. However, you can configure the logger to emit human readable output by setting the format to human. Tab-delimited format can be specified by setting the format to tsv.

A custom formatting function can be specified via the format option which will be invoked and passed the combined log message context. The function should return the message to output without a trailing new line.

format(context): string

Add Destinations

Previously, destinations implied a format. There was a JsonDest and a ConsoleDest which always used a human readable output format.

With this update, destination are separated from output formats. There are 3 supplied destinations. The stdoutDest and consoleDest. The stdoutDest is the high performance raw destination. The consoleDest uses console.log and console.error and is somewhat slower. On Node, console.log redundantly prefixes output with the Lambda requestID and timestamp.

Fixes

  • none

See

v0.9.2

09 Aug 02:00
Compare
Choose a tag to compare

Minor Feature Release

Features / Changes

  • Add flag and prefix constructor options

Flag and Prefix

To support easier alert scanning and detection of log messages, it is often desired to flag error channel messages with a unique string.

The flag option if set to a string, then error and fatal channel messages will define a property of that string name set to the true value.

e.g.

let log = new SenseLogs({flag: 'ERROR_DETECTED'})
log.error('Bad condition')

Will output

{
    "@chan": "error",
    "message": "Bad condition",
    "ERROR_DETECTED": true,

You may also set the flag option to a hash:

let log = new SenseLogs({flag: { error: 'ERROR', fatal: 'ERROR'})
log.error('Bad condition')

May be set to an object map of channel names and property values to set for those channel names. Default to null.

If you are using the console destination, you can set the prefix option to a property name so that log messages will use that prefix after it has been converted to uppercase. The default prefix is "@chan" which causes messages to be prefixed with INFO, ERROR, FATAL etc. This is similar to what node on Lambda does.

Fixes

  • none

See

v0.9.1

30 Jul 01:54
Compare
Choose a tag to compare

Major Feature Release

Features / Changes

  • Simplified API -- support on-demand log channels

  • Rename levels -> channels

  • Update README

Breaking Changes

The addLevels, getLevels and constructor levels property have been removed.

The rationale is that levels are not needed. Users can create levels on-demand via the emit() method. This is hugely beneficial as you can add custom logging to modules without needing to pre-declare the log channel. The log message won't be emitted until you enable the filter (without redeploying code). You don't need to enable the log level (now called channels) anymore.

Previously you needed to addLevels (channels) for custom log channels. Now you just use log.emit('your-custom-channel'). And this will be dormant in your code until you enable the channel filter.

Fixes

  • none

See