pax_global_header00006660000000000000000000000064137425577750014540gustar00rootroot0000000000000052 comment=80dfaef91ee87008f4ed2b6e78921d383bccd406 abstract-logging-2.0.1/000077500000000000000000000000001374255777500147675ustar00rootroot00000000000000abstract-logging-2.0.1/Readme.md000066400000000000000000000020561374255777500165110ustar00rootroot00000000000000# 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/) abstract-logging-2.0.1/index.js000066400000000000000000000003531374255777500164350ustar00rootroot00000000000000'use strict' function noop () { } const proto = { fatal: noop, error: noop, warn: noop, info: noop, debug: noop, trace: noop } Object.defineProperty(module, 'exports', { get () { return Object.create(proto) } }) abstract-logging-2.0.1/package.json000066400000000000000000000012021374255777500172500ustar00rootroot00000000000000{ "name": "abstract-logging", "version": "2.0.1", "description": "A noop logger that conforms to the Log4j interface for modules to stub out internal logging", "main": "index.js", "scripts": { "test": "node test.js" }, "repository": { "type": "git", "url": "git+https://github.com/jsumners/abstract-logging.git" }, "keywords": [ "log", "logging", "logger", "pino" ], "author": "James Sumners ", "license": "MIT", "bugs": { "url": "https://github.com/jsumners/abstract-logging/issues" }, "homepage": "https://github.com/jsumners/abstract-logging#readme" } abstract-logging-2.0.1/test.js000066400000000000000000000005411374255777500163040ustar00rootroot00000000000000'use strict' const assert = require('assert') const one = require('./') const two = require('./') assert.notEqual(one, two) assert.ok(one.info) assert.equal(Function.prototype.isPrototypeOf(one.info), true) two.info = () => 'info' const result1 = one.info() assert.equal(result1, undefined) const result2 = two.info() assert.equal(result2, 'info')