@adobe/openwhisk-action-logger
Logger for OpenWhisk Actions
Last updated 13 days ago by trieloff .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @adobe/openwhisk-action-logger 
SYNC missed versions from official npm registry.

OpenWhisk Action Logger

Logger for OpenWhisk actions.

Status

GitHub license GitHub issues CircleCI codecov

LGTM Code Quality Grade: JavaScript

API Reference

logger

Wrap function that returns an OpenWhisk function that is enabled with logging.

Usage:

const { wrap } = require('@adobe/openwhisk-action-utils');
const { logger } = require('@adobe/openwhisk-action-logger');

async function main(params) {
  const { __ow_logger: log } = params;

  //…my action code…
  log.info('.....');
}

module.exports.main = wrap(main)
  .with(logger.trace)
  .with(logger);

logger~init(params, [logger], [level]) ⇒ SimpleInterface

Initializes helix-log that adds additional activation related fields to the loggers. It also looks for credential params and tries to add additional external logger (eg. coralogix, papertrail).

It also initializes params.__ow_logger with a SimpleInterface if not already present.

Kind: inner method of logger
Returns: SimpleInterface - the helix-log simple interface

Param Type Default Description
params * openwhisk action params.
[logger] MultiLogger rootLogger a helix multi logger. defaults to the helix rootLogger.
[level] string Overall log-level. defaults to params.LOG_LEVEL or 'info`.

logger~trace(fn) ⇒ ActionFunction

Creates a tracer function that logs invocation details on trace level before and after the actual action invocation.

Kind: inner method of logger
Returns: ActionFunction - an action function instrumented with tracing.

Param Type Description
fn ActionFunction original OpenWhisk action main function

logger~logger(fn, [opts]) ⇒ ActionFunction

Wrap function that returns an OpenWhisk function that is enabled with logging.

Kind: inner method of logger
Returns: ActionFunction - a new function with the same signature as your original main function

Param Type Default Description
fn ActionFunction original OpenWhisk action main function
[opts] object Additional wrapping options
[opts.fields] object Additional fields to log with the ow logging fields.
[opts.logger] MultiLogger rootLogger a helix multi logger. defaults to the helix rootLogger.

Example

const { wrap } = require('@adobe/openwhisk-action-utils');
const { logger } = require('@adobe/openwhisk-action-logger');

async function main(params) {
  const { __ow_logger: log } = params;

  //…my action code…
  log.info('.....');
}

module.exports.main = wrap(main)
  .with(logger.trace)
  .with(logger);

Current Tags

  • 2.2.2                                ...           latest (13 days ago)

12 Versions

  • 2.2.2                                ...           13 days ago
  • 2.2.1                                ...           2 months ago
  • 2.2.0                                ...           9 months ago
  • 2.1.1                                ...           9 months ago
  • 2.1.0                                ...           10 months ago
  • 2.0.4                                ...           10 months ago
  • 2.0.3                                ...           a year ago
  • 2.0.2                                ...           a year ago
  • 2.0.1                                ...           a year ago
  • 2.0.0                                ...           a year ago
  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           a year ago

Copyright 2014 - 2016 © taobao.org |