Skip to content

Userland winston log transports to customize zwave-js logging

License

Notifications You must be signed in to change notification settings

zwave-js/log-transports

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Z-Wave JS: Log transports

node-zwave-js offers its users the ability to replace the default winston log transports with custom implementations. This repository is the home for userland log transports.

Available transports:

Implementing new transports

  1. Copy the contents of package-template into a new folder under packages. That folder should have the same name as the transport, e.g. mysupercoolservice.
  2. Edit package.json of your new transport:
    -   "name": "@zwave-js/log-transport-template",
    +   "name": "@zwave-js/log-transport-mysupercoolservice",
    -   "private": true,
        "version": "1.0.0-alpha.0",
    -   "description": "Template log transport for Z-Wave JS",
    +   "description": "My super cool log transport for Z-Wave JS",
  3. Register the new transport in jest.config.js:
       moduleNameMapper: {
         "^@zwave-js/log-transport-logfmt(.*)": "<rootDir>/packages/logfmt/src$1",
    +    "^@zwave-js/log-transport-mysupercoolservice(.*)": "<rootDir>/packages/mysupercoolservice/src$1",
       },
  4. (optional) Add dependencies for your new transport module locally:
    lerna add your-dependency --scope=@zwave-js/log-transport-mysupercoolservice
  5. (optional) Add type declarations for your new transport module in the root:
    yarn add --dev -W @types/your-dependency

Quick Links