https://github.com/yerkopalma/tiny-log
Simple and small logger for node and the browser.
https://github.com/yerkopalma/tiny-log
browser log logging node
Last synced: 2 months ago
JSON representation
Simple and small logger for node and the browser.
- Host: GitHub
- URL: https://github.com/yerkopalma/tiny-log
- Owner: YerkoPalma
- License: mit
- Created: 2017-03-13T19:07:50.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-16T02:14:53.000Z (about 8 years ago)
- Last Synced: 2025-01-25T07:11:20.276Z (4 months ago)
- Topics: browser, log, logging, node
- Language: JavaScript
- Size: 19.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: license
Awesome Lists containing this project
README
# tiny-log [](https://www.npmjs.com/package/@yerkopalma/tiny-log)
[](https://travis-ci.org/YerkoPalma/tiny-log) [](https://codecov.io/github/yerkopalma/tiny-log) [](https://github.com/feross/standard)> Simple and small logger for node and the browser.

# Install
```bash
$ npm install --save-dev @yerkopalma/tiny-log
```# Usage
```js
var Log = require('tiny-log')// in production, all log messagges lower than warning will be omited
log = process.env.NODE_ENV === 'production'
? Log('warn')
: Log('debug')log.debug('debug')
log.warn('debug')
log.error('debug')
log.fatal('Oh boy...')log.dump({
hello: 'world'
})
```Every log message, except dump messages, is composed by a timestamp, a context (the name of the caller function) and the formated message. If no context is provided (anonymous or undefined function) `'unknown'` is printed as context.
Dump messages, are some kinf of yaml representation of objects.# license
[MIT](/license) © [Yerko Palma](https://github.com/YerkoPalma).