https://github.com/awinterman/yeslog
i wrote a logging thing. probably not better than any other logging thing, but i like it.
https://github.com/awinterman/yeslog
Last synced: 25 days ago
JSON representation
i wrote a logging thing. probably not better than any other logging thing, but i like it.
- Host: GitHub
- URL: https://github.com/awinterman/yeslog
- Owner: AWinterman
- License: apache-2.0
- Created: 2014-12-23T21:13:31.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-12-03T19:10:30.000Z (over 10 years ago)
- Last Synced: 2025-02-12T08:48:19.327Z (over 1 year ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# yeslog
yes, I wrote another logging module.
It's a super simple implementation/api.
```js
var Log = require('yeslog')
var path = require('path')
var filename = path.join(__dirname, __filename)
var log = new Log('INFO', filename, process.stderr)
log.debug('yeah, so what') // nothing written
// these all get logged:
log.info('interesting stuff')
log.warn('this is the kinda bad?')
log.error('stop!')
```
## API
```
var Log = require('yeslog')
var log = new Log(level, name, stream)
```
### Arguments
- `level`: one of the following strings:
- `'TRACE'`
- `'DEBUG'`
- `'INFO'`
- `'WARN'`
- `'ERROR'`
- `'FATAL'`
Determines which messages get written to the stream.
- `name`: A string to include which describes the file originating the error.
- `stream`: A writable stream to which to write messages.
### Methods
- `log` is an object with methods:
- `trace`
- `debug`
- `info`
- `warn`
- `error`
- `fatal`
Each of which expects a string to be passed to `util.format` and writes it to
the supplied stream.
Each output line has the format:
```
LEVEL (isodate) [name]: MESSAGE
```