4.0.2 • Published 5 years ago

@shopup/logger v4.0.2

Weekly downloads
-
License
-
Repository
-
Last release
5 years ago

Usage

import logger from '@blendo/node-logger'

logger.error("message",{any:"extra data"})
logger.info("message",{any:"extra data"})
logger.warning("message",{any:"extra data"})

Levels

{
  emerg: 0,
  alert: 1,
  crit: 2,
  error: 3,
  warning: 4,
  notice: 5,
  info: 6,
  debug: 7
}

Format

{
    "level":"info",
    "timestamp":"2019-03-18T09:48:40.539Z",
    "message":"message",
    "metadata": {"any":"extra data"}
}

Configuration

In each application optionally, should add a configuration property like the following.

logger:
    sentry:
        dsn:  # {String} (default: null) Sentry client key (Project -> settings -> Client Keys)
        level:  # {String} (default: error) Log level,
    console: # {Boolean} (default: true) show logs in console: false in production by default
    slack:
        token:  # {String} (default: null) Slack app token (...),
        level:  # {String} (default: crit) Log level,
        username:  # {String} (default: service name) The username of the sender,
        channel:  # {String} (default: null) Channel id,
    rotation: # If rotation is not set, will be disabled
        filename: # {String} (default: application.log) Specifies the generated filename.
        rotatedFilename: # {String} (default: {filename}-%DATE%.%INDEX%.log) Specifies the filename of the file generated by the rotation. Filename can include optionally placeholders, to take control of the name of the rotated file. available placeholders are: %DATE%:the date using the datePattern option, %INDEX%: tha index of the file.
        path: # {String} (default: null) Specifies the base path for files.
        size: # {String} (default: 20M) Specifies the file size to rotate the file. (B: Bites K: KiloBites M: MegaBytes G: GigaBytes)
        interval: # {String} (default: null) Specifies the time interval to rotate the file.(ie: '5s', '5m','2h','1d','1M')
        datePattern: # {String} (default: YYYY-MM-DD) A string representing the moment.js date format to be used for rotating.
        compress: # {Boolean} (default: true) Specifies compression method of rotated files.
        maxFiles: # {Integer} (default: null) Specifies the maximum number of rotated files to keep.
        maxSize: # {String} (default: null) Specifies the maximum size of rotated files to keep.

for more about rotation, check rotating-file-stream

4.0.2

5 years ago

4.0.1

5 years ago

4.0.0

5 years ago

4.0.2-beta

5 years ago

4.0.1-beta

5 years ago

4.0.0-beta

5 years ago

3.1.3

5 years ago

3.1.2

5 years ago

3.2.0

6 years ago

3.1.1

6 years ago

3.1.0

6 years ago

3.0.4

6 years ago

3.0.3

6 years ago

3.0.2

6 years ago

3.0.0

6 years ago

2.0.14

6 years ago

2.0.13

6 years ago

2.0.12

6 years ago

2.0.11

6 years ago

2.0.10

6 years ago

2.0.8

6 years ago

2.0.7

6 years ago

2.0.6

6 years ago

2.0.5

6 years ago

2.0.4

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago