@rester/logger

0.21.2 • Public • Published

Rester Logger

Rester 框架的日志模块,GitHub 项目主页

Logger module for Rester Framework, GitHub Project Home.

安装 / Install

npm i -S @rester/logger

快速入门 / Quick Start

快速使用 / Quick Usage

直接获取 logger 对象实例,然后使用 logger 实例的 logwarn 等方法来输出日志。

Get the logger object instance, and use the logger instance's logwarn etc. methods to output log.

import { logger } from '@rester/logger';

logger.log('Hello, World!');
logger.warn('Something alert!');

自定义实例 / Custom Instance

创建一个自定义 Logger 实例,可以指定 stdoutstderr 等流。

Create a custom Logger instance, and specify stdoutstderr etc. streams.

import { Logger, LevelMap } from '@rester/logger';

const logger = new Logger({
  name: 'custom-logger',
  stdout: process.stdout,
  stderr: process.stderr,
  logout: 'path/to/log/out.log',
  logerr: 'path/to/log/err.log',
  level: LevelMap.DEBUG,
});

Logger 配置类型如下:

Configure type of Logger as follows:

/** Logger config. */
export interface LoggerConfig {
  /** Colorful logger, default to true. */
  colorful?: boolean;
  /** Path to save error. */
  logerr?: string;
  /** Path to save output. */
  logout?: string;
  /** Log level, default to ALL. */
  level?: LevelMap;
  /** Logger name. */
  name: string;
  /** Standard output. */
  stdout?: Writable;
  /** Standard error. */
  stderr?: Writable;
}

作者 / Authors

IInfinity 夜寒苏, Email, Github, Home Page (Under construction).

许可 / License

THE MIT LICENSE for code.

Copyright © 2018+ Devin Don

LICENSE: MIT

Click https://raw.githubusercontent.com/DevinDon/license/master/THE%20MIT%20LICENSE to view a copy of this license.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

THE CC-BY-NC-4.0 LICENSE

Copyright © 2018+ Devin Don

LICENSE: CC BY-NC 4.0

Click https://raw.githubusercontent.com/DevinDon/license/master/THE%20CC%20BY-NC%204.0%20LICENSE to view a copy of this license.

This work is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License.

To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/4.0/

or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.

/@rester/logger/

    Package Sidebar

    Install

    npm i @rester/logger

    Weekly Downloads

    0

    Version

    0.21.2

    License

    MIT

    Unpacked Size

    39.9 kB

    Total Files

    47

    Last publish

    Collaborators

    • resteradmin
    • devindon