Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/elonehoo/log
Keep the log output as simple as possible
https://github.com/elonehoo/log
console log typescript vite
Last synced: 10 days ago
JSON representation
Keep the log output as simple as possible
- Host: GitHub
- URL: https://github.com/elonehoo/log
- Owner: elonehoo
- License: mit
- Created: 2022-05-07T12:02:46.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-15T04:08:56.000Z (7 months ago)
- Last Synced: 2024-04-17T06:53:33.200Z (7 months ago)
- Topics: console, log, typescript, vite
- Language: TypeScript
- Homepage: https://log.elonehoo.xyz
- Size: 624 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
@elonehoo/log
## Example
```typescript
import log from '@elonehoo/log'// levels: 1 - fatal, 2 - info, 3 - error, 4 - warn, 5 - debug, 6 - trace (default is 2)
log.setLevel(6) // the larger the number, the higher the verbosity// simple logging
log.trace('trace message')
log.debug('debug message')
log.info('info message')
log.error('error message')
log.warn('warn message')
log.fatal('fatal message')// passing params
log.debug('debug message with array:', [1, 2, 3, 4], { a: 1, b: 2 })
log.debug('debug message with object:', { a: 1, b: 2 })
log.debug('debug message with number:', Math.random())// using scopes
const scopedLog = log.scope('scope')
scopedLog.debug('debug message')
```## Screenshots
![demo.png](./public/img/demo.png)