|
download
raw
1.07 kB
# abstract-logging
This module provides an interface for modules to include so that they can
support logging via an external logger that conforms to the standard Log4j
interface. One such logger is [Pino](https://npm.im/pino). This module
is intended for modules that are meant to be used by other modules.
Example:
```js
'use strict'
function AwesomeLibrary (options) {
this.log = (options.logger) ? options.logger : require('abstract-logging')
}
AwesomeLibrary.prototype.coolMethod = function () {
this.log.trace('AwesomeLibrary.coolMethod was invoked')
return {}
}
module.exports = AwesomeLibrary
```
## Interface
Available methods:
+ `fatal`
+ `error`
+ `warn`
+ `info`
+ `debug`
+ `trace`
All methods are no operation functions.
Some loggers, like [Pino](https://getpino.io/), implement a `child()` method. This method can be easily added to an `abstract-logging` instance when stubbing out such loggers:
```js
const logger = require('abstract-logging')
logger.child = () => logger
```
## License
[MIT License](http://jsumners.mit-license.org/)

Xet Storage Details

Size:
1.07 kB
·
Xet hash:
dfe1e72bf5ac47a2d658b2350017c293230f8e15154ceb9503703f0c80708cd8

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.