Giter VIP home page Giter VIP logo

openwhisk-action-logger's Introduction

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);

openwhisk-action-logger's People

Contributors

tripodsan avatar semantic-release-bot avatar renovate[bot] avatar trieloff avatar renovate-bot avatar greenkeeper[bot] avatar dependabot[bot] avatar kptdobe avatar dominique-pfister avatar marquiserosier avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.