@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:
- console - logs of all levels
- icon-magic-run.log - logs of all levels
- icon-magic-error.log - only error logs
Usage
import { Logger } from "@icon-magic/logger";
const LOGGER: logger = new Logger("icon-magic:icon-models:asset");
LOGGER.debug("Icon generation has begun");
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