# kth-console-log

> Small console library used as default logger in KTH npm packages

Latest version **1.2.2** (published 2017-01-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install kth-console-log
pnpm add kth-console-log
yarn add kth-console-log
bun add kth-console-log
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.2 |
| Published | 2017-01-10 |
| First published | 2017-01-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jens Tinglev |
| Maintainers | jotun |

## Links

- npm: https://www.npmjs.com/package/kth-console-log
- npm.io page: https://npm.io/package/kth-console-log

## Recent versions

- 1.2.2 (latest) — 2017-01-10
- 1.2.1 — 2017-01-10
- 1.2.0 — 2017-01-10
- 1.1.0 — 2017-01-09
- 1.0.0 — 2017-01-09

## README

[![NPM](https://nodei.co/npm/kth-console-log.png)](https://npmjs.org/package/kth-console-log)

# kth-console-log
Simple console logger used for default logging in our npm packages

This module can be use as a default, node-bunyan compatible logger in projects where basic logging that should be overridable should be available.

## Requirements of overriding logger
If you use kth-console-log in your module and want to replace it with a custom logger, just make sure that the logger you are providing adheres to the following pseudo interface:
```
function trace(...args)
function debug(...args)
function info(...args)
function warn(...args)
function error(...args)
function fatal(...args)
```

## Example of usage

In the module that should have an overridable logger add:
```js
const defaultLogger = require('kth-console-log')
var log = defaultLogger
```

Then export a getter/setter for the logger along with everything else that should be exported from the module:
```js
  return {
    funcToExport: function() { ... },
    get logger() {
      return log
    },
    set logger(logger) {
      log = logger
    }
  }
```

Then log as usual in the module itself:
```js
log.info('This is some info-level logging')
```

And in the main application that depends on the module just override the exported logger with your own logging object:
```js
var myModule = require('my-module-with-overridable-logging')
var myLogger = require('my-initialized-logger')
myModule.logger = myLogger
```

---
_Source: https://npm.io/package/kth-console-log · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
