0.0.2 • Published 5 years ago
@project-reporter/yaml-format v0.0.2
Project Reporter - Yaml Format
This package contains a simple TFormatFunction
that convert log message into a valid Yaml
format.
Installation
Using NPM.
npm i @project-reporter/yaml-format
Using Yarn.
yarn add @project-reporter/yaml-format
Usage Example
import { FileReporter } from '@project-reporter/file-reporter';
import { yamlFormat } from '@project-reporter/yaml-format';
const reporter = new FileReporter(); // or any other logger.
reporter.setFormat(yamlFormat); // use it as a format function.
reporter.error(new Error('Something wrong'));
Example output
---
level: ERROR
timestamp: '2022-08-07 15:12:22'
message: 'Something wrong'
stack:
- file: 'test.js'
method: Object.<anonymous>
position:
line: 5
column: 59
- file: 'internal/modules/cjs/loader.js'
method: Module._compile
position:
line: 689
column: 30
- file: 'internal/modules/cjs/loader.js'
method: Object.Module._extensions..js
position:
line: 700
column: 10
# ...