2.4.7 • Published 3 years ago

@adobe/openwhisk-action-logger v2.4.7

Weekly downloads
2,394
License
Apache-2.0
Repository
github
Last release
3 years ago

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

ParamTypeDefaultDescription
args*openwhisk action params or function arguments.
loggerMultiLoggerrootLoggera helix multi logger. defaults to the helix rootLogger.
levelstringOverall 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.

ParamTypeDescription
fnActionFunction | HEDYFunctionoriginal 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

ParamTypeDefaultDescription
fnActionFunction | HEDYFunctionoriginal OpenWhisk action main function
optsobjectAdditional wrapping options
opts.fieldsobjectAdditional fields to log with the ow logging fields.
opts.loggerMultiLoggerrootLoggera 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);
2.4.7

3 years ago

2.4.6

3 years ago

2.4.5

3 years ago

2.4.4

3 years ago

2.4.3

3 years ago

2.4.2

3 years ago

2.4.1

3 years ago

2.4.0

3 years ago

2.3.1

3 years ago

2.3.0

3 years ago

2.2.2

3 years ago

2.2.1

4 years ago

2.2.0

4 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.4

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago