https://github.com/roosoft/logger
Manage application execution information
https://github.com/roosoft/logger
Last synced: about 2 months ago
JSON representation
Manage application execution information
- Host: GitHub
- URL: https://github.com/roosoft/logger
- Owner: RooSoft
- Created: 2018-06-03T13:44:40.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-06-03T14:55:05.000Z (about 8 years ago)
- Last Synced: 2025-03-15T04:35:44.101Z (over 1 year ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# logger
## Manage application execution information
### Environment variables
LOG\_LEVEL | Values
--- | :---
Available | `trace`, `debug`, `info`, `warn`, `error`
Default | `info`
LOG\_FORMAT | Values
--- | :---
Available | `raw`, `json`, `console`
Default | `console`
LOG\_DATE\_FORMAT | Values
--- | :---
Available | see [moment.js](https://momentjs.com/docs/#/displaying/format) formats
Default | `YYYY-MM-DD`
LOG\_TIME\_FORMAT | Values
--- | :---
Available | see [moment.js](https://momentjs.com/docs/#/displaying/format) formats
Default | `H:mm:ss.SSS `
### How to use
Setup environment log level and format environment variables in your application. When logging from files, first require this library.
```javascript
const log = require('logger')
```
Then log in a similar way you would use `console.log`, except using one of these:
* `log.trace`
* `log.debug`
* `log.info`
* `log.warn`
* `log.error`
##### Example
```javascript
log.info('what is happening right now')
```