# egg-format-logger

> An egg plugin for formatting logs. This plugin and [egg-logger](https://github.com/eggjs/egg-logger) to work together.

Latest version **1.0.0** (published 2021-07-19) · 0 weekly downloads

## Install

```sh
npm install egg-format-logger
pnpm add egg-format-logger
yarn add egg-format-logger
bun add egg-format-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.0 |
| Published | 2021-07-19 |
| First published | 2021-07-19 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 5.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | erencode |
| Keywords | egg, egg-plugin, eggPlugin, egg-logger, logger, format, format-logger, egg-format-logger |

## Links

- npm: https://www.npmjs.com/package/egg-format-logger
- npm.io page: https://npm.io/package/egg-format-logger

## Dependencies (2)

- [js-shortid](https://npm.io/package/js-shortid.md) ^0.1.1
- [egg-ts-helper](https://npm.io/package/egg-ts-helper.md) ^1.25.9

## 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.0 (latest) — 2021-07-19
- 0.0.1 — 2021-07-19

## README

# egg-format-logger
English | [简体中文](./README-zh_CN.md)
## Introduced
An egg plugin for formatting logs. This plugin and [egg-logger](https://github.com/eggjs/egg-logger) to work together.
## Install
```shell
npm i egg-format-logger --save
```
## Configuration
Change `${app_root}/config/plugin.js` to to enable this plugin.

```js
exports.formatLogger = {
  enable: true,
  package: 'egg-format-logger',
};
```

Configure information in `${app_root}/config/config.default.js  `
```js
config.formatLogger = {
  formatter: (meta) => {
    return  `[${meta.date}][${meta.pid}][${meta.level}][${meta?.ctx?.response?.status}]::${meta.message}`;
  }
}
```
#### Meta
| property | description |
| -- | -- |  
| ctx | [Egg.Context](https://eggjs.org/en/basics/objects.html#context) |
| paddingMessage | Part of the request information, including the domain name, request time, request method |  
| level   | The level of logging |  
| date   | The current time |  
| pid   | The process ID |  
| hostname  | The host name |  
| message | Log information to be printed |

## License
[MIT](./LICENSE)

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