2.6.8 • Published 6 years ago

lark-log v2.6.8

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

lark-log

This is Lark.js log module.

NPM version build status Test coverage NPM downloads Node.js dependencies

Useage

sample

const LarkLogger = require('lark-log');

const logger = new LarkLogger({ 'using-default': true });

logger.notice("Hello");

configure

const LarkLogger = require('lark-log');

const logger = new LarkLogger();

const config = {
    {
    "@description": "This is the default config",
    "level": 1,
    "methods": {
        "debug": {
            "level": 1,
            "output": "console"
        },
        "print": {
            "level": 2,
            "output": "console"
        },
        "trace": {
            "level": 2,
            "output": "system"
        },
        "notice": {
            "level": 3,
            "output": "system"
        },
        "warn": {
            "level": 4,
            "output": "system"
        },
        "error": {
            "level": 5,
            "output": "error"
        },
        "fatal": {
            "level": 5,
            "output": "error"
        }
    },
    "outputs": {
        "default": {
            "line-max-length": 2000,
            "format": "<%= method.toUpperCase() %>:\t<%= date('yyyy-mm-dd HH:MM:ss')%>\t<%= content %>",
            "path-prefix": "logs/",
            "path-suffix": ".log"
        },
        "console": null,
        "system": {
            "path": "system"
        },
        "error": {
            "path": "system",
            "path-suffix": ".log.wf"
        }
    }
};

logger.configure(config);

logger.debug('debug');// write "debug " to terminal
logger.notice('notice');// write "NOTICE: {DATETIME} notice" to system.log, {DATETIME} is in "yyyy-mm-dd HH:MM:ss" style
logger.error('error');//write to system.log.wf

logrotate

logger.configure({
    "outputs": {
        "default": {
            "path-suffix": ".log.<%= date('yyyymmddHH') %>"
        }
    }
});
  • If '<%' exists in path (including prefix and suffix), the path will be regarded as a dynamic path. LarkLog calculates the path every when an output came.
2.6.8

6 years ago

2.6.7

6 years ago

2.6.6

6 years ago

2.6.5

6 years ago

2.6.4

6 years ago

2.6.3

6 years ago

2.6.2

6 years ago

2.6.1

6 years ago

2.6.0

6 years ago

2.5.1

7 years ago

2.5.0

7 years ago

2.4.1

7 years ago

2.4.0

7 years ago

2.3.0

7 years ago

2.2.1

7 years ago

2.2.0

8 years ago

2.1.1

8 years ago

2.1.0

8 years ago

2.0.7

8 years ago

2.0.6

8 years ago

2.0.5

8 years ago

2.0.4

8 years ago

2.0.2

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago

1.3.0

8 years ago

1.2.10

9 years ago

1.2.9

9 years ago

1.2.8

9 years ago

1.2.7

9 years ago

1.2.5

9 years ago

1.2.4

9 years ago

1.2.3

9 years ago

1.2.2

9 years ago

1.2.0

9 years ago

1.1.2

9 years ago

1.1.1

9 years ago

1.1.0

9 years ago

1.0.0

9 years ago

0.2.0

9 years ago

0.1.5

9 years ago

0.0.0

9 years ago