# openwhisk-action-logger
**Repository Path**: mirrors_adobe/openwhisk-action-logger
## Basic Information
- **Project Name**: openwhisk-action-logger
- **Description**: Logger for openwhisk actions.
- **Primary Language**: Unknown
- **License**: Apache-2.0
- **Default Branch**: main
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-09-24
- **Last Updated**: 2026-03-21
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# OpenWhisk Action Logger
> Logger for OpenWhisk actions.
## Status
[](https://github.com/adobe/openwhisk-action-logger/blob/main/LICENSE.txt)
[](https://github.com/adobe/openwhisk-action-logger/issues)
[](https://circleci.com/gh/adobe/openwhisk-action-logger)
[](https://codecov.io/gh/adobe/openwhisk-action-logger)
[](https://greenkeeper.io/)
[](https://lgtm.com/projects/g/adobe/openwhisk-action-logger)
# API Reference
## logger
Wrap function that returns an OpenWhisk function that is enabled with logging.
**Usage:**
```js
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](#module_logger)
* [~init(args, [logger], [level])](#module_logger..init) ⇒ SimpleInterface
* [~trace(fn)](#module_logger..trace) ⇒ ActionFunction \| HEDYFunction
* [~logger(fn, [opts])](#module_logger..logger) ⇒ ActionFunction \| HEDYFunction
### 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](#module_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](#module_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](#module_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**
```js
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);
```