# @digitalronin/logger

> Console logger for node and browser environment

Latest version **1.0.3** (published 2020-04-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install @digitalronin/logger
pnpm add @digitalronin/logger
yarn add @digitalronin/logger
bun add @digitalronin/logger
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2020-04-16 |
| First published | 2020-04-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 10.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Ronnie Chong |
| Maintainers | ronniechong |
| Keywords | logging, logger, log, console, debug, node, browser, helper |

## Links

- npm: https://www.npmjs.com/package/@digitalronin/logger
- Repository: https://github.com/ronniechong/logger
- Issues: https://github.com/ronniechong/logger/issues
- npm.io page: https://npm.io/package/@digitalronin/logger

## Dependencies (2)

- [chalk](https://npm.io/package/chalk.md) ^4.0.0
- [@digitalronin/browser-or-node](https://npm.io/package/@digitalronin/browser-or-node.md) ^1.0.1

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 1.0.3 (latest) — 2020-04-16
- 1.0.2 — 2020-04-15

## README

# @digitalronin/logger

![NPM](https://img.shields.io/npm/l/@digitalronin/logger)
[![npm (scoped)](https://img.shields.io/npm/v/@digitalronin/logger)](https://npmjs.org/package/@digitalronin/logger "View this project on npm")
[![Build Status](https://travis-ci.org/ronniechong/logger.svg?branch=master)](https://travis-ci.com/ronniechong/logger)

A simple wrapper for `console.log` for Node or browser. The former supports colors, using `chalk` [Link](https://github.com/chalk/chalk)

## Installation

```bash
# Using Yarn
> yarn add @digitalronin/logger --dev

# Using NPM
> npm install @digitalronin/logger -D
```

## Usage

### Browser

```javascript
const Logger = require('@digitalronin/logger');
const l = new Logger();

// console.log
l.log('Test log');

// console.error
l.error('Test error');

// console.log
l.info('Test info');
```

### Node

```javascript
const Logger = require('@digitalronin/logger');
const l = new Logger();

// console.log in white
l.log('Test log');

// console.log in red
l.error('Test error');

// console.log in blue
l.info('Test info');
```

#### Overwriting default colors

Only the following [colors](https://github.com/chalk/chalk#colors) is supported

```javascript
const Logger = require('@digitalronin/logger');
const l = new Logger({
  error: 'blue',
  info: 'white',
  log: 'green',
});
```

---
_Source: https://npm.io/package/@digitalronin/logger · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
