autologger
Javascript utility for automatic logging of functions and classes.
Install
$ npm install autologger --save
Usage
const Autolog = ; const autolog = typelogger; let target = ;
Variable | Type | Required |
---|---|---|
options | object | no |
type | string | yes |
logger | object | yes |
target | function or class | yes |
options
Logs the wrapping of a variable by an automatic logger. Must contain two properties:
Properties | Type | Required |
---|---|---|
preprocess | function | no |
postprocess | function | no |
type
The type of the variable to which automatic logging is applied. One of the following values:
- class
- function
- method
logger
Logs the call steps. Must contain two properties:
Properties | Type | Required |
---|---|---|
before | function | yes |
after | function | yes |
target
The function or class to which automatic logging will be applied.
Example
Logger
const logger = before: consolelog after: consolelog;
Function
const autolog = 'function'logger; let example = ;
Class
const autolog = 'class'logger; let Example = ;
with decorators
const autolog = 'class'logger; @autolog /* ... */
Class method
const autolog = 'method'logger; @autolog { /* ... */ }
License
This project is licensed under MIT.