# operation-logger

> 运营日志，除了打印日志信息，额外打印信息的触发时间，触发文件名，文件行数、列数，触发的上下文函数名。方便精准定位问题。

Latest version **1.0.1** (published 2018-11-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install operation-logger
pnpm add operation-logger
yarn add operation-logger
bun add operation-logger
```

## 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.0.1 |
| Published | 2018-11-26 |
| First published | 2018-11-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 3.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | combineli |
| Maintainers | jsfiend |
| Keywords | operation-logger, logger, winston |

## Links

- npm: https://www.npmjs.com/package/operation-logger
- Repository: https://github.com/JSFiend/operation-logger
- Homepage: https://github.com/JSFiend/operation-logger#readme
- Issues: https://github.com/JSFiend/operation-logger/issues
- npm.io page: https://npm.io/package/operation-logger

## Dependencies (4)

- [is](https://npm.io/package/is.md) ^3.2.1
- [winston](https://npm.io/package/winston.md) ^3.1.0
- [callsites](https://npm.io/package/callsites.md) ^3.0.0
- [winston-daily-rotate-file](https://npm.io/package/winston-daily-rotate-file.md) ^3.5.1

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2018-11-26
- 1.0.0 — 2018-11-26

## README

## 运营日志
运营日志，除了打印日志信息，额外打印信息的触发时间，触发文件名，文件行数、列数，触发的上下文函数名。方便精准定位问题。

#### Example
``` javascript
const Logger = require("./index.js");

let logger = new Logger("test");

logger.log('message', [1,2,3], {a:1, b:2});

function testFunction () {
    logger.log('message2', [1,2,3], {a:1, b:2});
}

testFunction();
```

#### OUTPUT
> 2018-11-26 20:06:05.120 test.js:6|8 message [1,2,3] {"a":1,"b":2}

> 2018-11-26 20:06:05.130 test.js:9|12 testFunction message2 [1,2,3] {"a":1,"b":2}

### USAGE
``` javascript
const logger = new Logger('interface', {dirname: './', maxFiles: '7d'})
```

实例化有2个参数，日志名`name`， 参数`options`；
* options.dirname 日志文件存放路径，默认`.`
* options.maxFiles 日志存放多久，默认 `7d` 7天

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