Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/moonstar-x/node-logger
A logger with some colors and timestamps depending on the logging level.
https://github.com/moonstar-x/node-logger
Last synced: 4 days ago
JSON representation
A logger with some colors and timestamps depending on the logging level.
- Host: GitHub
- URL: https://github.com/moonstar-x/node-logger
- Owner: moonstar-x
- License: mit
- Created: 2020-06-08T17:06:05.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-07-30T22:52:16.000Z (4 months ago)
- Last Synced: 2024-11-01T08:48:00.100Z (13 days ago)
- Language: TypeScript
- Homepage:
- Size: 438 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![ci-build-status](https://img.shields.io/github/actions/workflow/status/moonstar-x/node-logger/on-push.yml?logo=github&label=build)](https://github.com/moonstar-x/node-logger)
[![issues](https://img.shields.io/github/issues/moonstar-x/node-logger?logo=github)](https://github.com/moonstar-x/node-logger)
[![bundle-size](https://img.shields.io/bundlephobia/min/@moonstar-x/logger)](https://www.npmjs.com/package/@moonstar-x/logger)
[![version](https://img.shields.io/npm/v/@moonstar-x/logger?logo=npm)](https://www.npmjs.com/package/@moonstar-x/logger)
[![downloads-week](https://img.shields.io/npm/dw/@moonstar-x/logger?logo=npm)](https://www.npmjs.com/package/@moonstar-x/logger)
[![downloads-total](https://img.shields.io/npm/dt/@moonstar-x/logger?logo=npm)](https://www.npmjs.com/package/@moonstar-x/logger)# @moonstar-x/logger
This is a small logging module that helps with a more organized message logging through color, logging type and timestamps.
## Usage
### Installation
With `npm`:
``` text
npm install @moonstar-x/logger
```or with `yarn`:
``` text
yarn add @moonstar-x/logger
```### Importing the Package
``` js
const logger = require('@moonstar-x/logger');
import logger from '@moonstar-x/logger';
```### Logging Messages
You can log multiple types of messages. Objects will be serialized and stack traces will be shown.
#### LOG
``` js
logger.log('message to log');
```#### INFO
``` js
logger.info('message to log');
```#### WARN
``` js
logger.warn('message to log');
```#### ERROR
``` js
logger.error('message to log');
```#### FATAL
``` js
logger.fatal('message to log');
```#### DEBUG
``` js
logger.debug('message to log');
```### Clear Console
You can clear the console with:
``` js
logger.clear();
```