This package has been deprecated

Author message:

This package is no longer maintained.

@adobe/openwhisk-action-logger
TypeScript icon, indicating that this package has built-in type declarations

2.4.7 • Public • Published

OpenWhisk Action Logger

Logger for OpenWhisk actions.

Status

GitHub license GitHub issues CircleCI codecov Greenkeeper badge 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(args, [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).

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
args * openwhisk action params or function arguments.
[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 | HEDYFunction

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 | HEDYFunction - an action function instrumented with tracing.

Param Type Description
fn ActionFunction | HEDYFunction original OpenWhisk action main function

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

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

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

Param Type Default Description
fn ActionFunction | HEDYFunction 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);

Readme

Keywords

Package Sidebar

Install

npm i @adobe/openwhisk-action-logger

Weekly Downloads

10

Version

2.4.7

License

Apache-2.0

Unpacked Size

62.2 kB

Total Files

12

Last publish

Collaborators

  • dylandepass
  • djaeggi
  • adobehalls
  • fullcolorcoder
  • marbec
  • tripod
  • garthdb
  • lazd
  • adobe-admin
  • patrickfulton
  • trieloff
  • shazron
  • krisnye
  • dcpfsdk
  • natebaldwin
  • devongovett
  • aspro83
  • symanovi
  • dpfister
  • stefan-guggisberg
  • korra
  • rofe
  • kptdobe