egg-format-logger

1.0.0 • Public • Published

egg-format-logger

English | 简体中文

Introduced

An egg plugin for formatting logs. This plugin and egg-logger to work together.

Install

npm i egg-format-logger --save

Configuration

Change ${app_root}/config/plugin.js to to enable this plugin.

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

Configure information in ${app_root}/config/config.default.js

config.formatLogger = {
  formatter: (meta) => {
    return  `[${meta.date}][${meta.pid}][${meta.level}][${meta?.ctx?.response?.status}]::${meta.message}`;
  }
}

Meta

property description
ctx Egg.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

/egg-format-logger/

    Package Sidebar

    Install

    npm i egg-format-logger

    Weekly Downloads

    1

    Version

    1.0.0

    License

    none

    Unpacked Size

    5.94 kB

    Total Files

    6

    Last publish

    Collaborators

    • erencode