# @icon-magic/logger

> Icon magic logger package.

Latest version **2.3.0-beta.0** (published 2021-07-27) · BSD-2-Clause license · 0 weekly downloads

## Install

```sh
npm install @icon-magic/logger
pnpm add @icon-magic/logger
yarn add @icon-magic/logger
bun add @icon-magic/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 | 2.3.0-beta.0 |
| Published | 2021-07-27 |
| First published | 2019-07-31 |
| Weekly downloads | 0 |
| License | BSD-2-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 12.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Ramitha Chitloor |
| Maintainers | epicmiller, rchitloor, omayeli |

## Links

- npm: https://www.npmjs.com/package/@icon-magic/logger
- npm.io page: https://npm.io/package/@icon-magic/logger

## Dependencies (1)

- [winston](https://npm.io/package/winston.md) ^3.2.1

## Recent versions

- 2.3.0-beta.0 (latest) — 2021-07-27
- 2.0.1-beta.0 (beta) — 2019-07-31
- 2.2.10-beta.0 — 2021-06-28
- 2.2.8-beta.0 — 2021-05-04

## README

# @icon-magic/logger

---

This package is responsible for exposing all the logging functionality for
icon-magic. It contains a wrapper around winston.js for including the filename
from where the logs are generated as a label in the logged message.

Logs are written to the following simulataneously:

1. console - logs of all levels
2. icon-magic-run.log - logs of all levels
3. icon-magic-error.log - only error logs

## Usage

```ts
// Import the logger module and it's interface
import { Logger } from "@icon-magic/logger";

// Instantiate by passing the name of the file. This will be a label in the log message
const LOGGER: logger = new Logger("icon-magic:icon-models:asset");

// Log a debug message
LOGGER.debug("Icon generation has begun");

// Log an error message
LOGGER.error("Oh no! An error has occurred!");
```

This will print logs of the following format:

```
<timestamp> [<label>] <logLevel> <msg>
```

For example,

```
2019-05-15T17:40:40.056Z [icon-magic:icon-models:asset] debug: Asset test created in /Users/rchitloo/workspace/artdeco-icons-source_trunk/icons/shadows
2019-05-15T17:40:40.060Z [icon-magic:icon-models:asset] debug: Asset creatingError created in /Users/rchitloo/workspace/artdeco-icons-source_trunk/icons/shadows
2019-05-15T17:40:40.060Z [icon-magic:icon-models:icon] error: MissingVariantError: Variant /Users/rchitloo/workspace/artdeco-icons-source_trunk/icons/shadows/creatingError.svg missing for icon /Users/rchitloo/workspace/artdeco-icons-source_trunk/icons/shadows
```

## Methods

The `logger` object exposes the following methods from `winston.logger`

- debug()
- info()
- error()

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