0.0.1 • Published 5 years ago

@project-reporter/xml-format v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

Project Reporter - XML Format

This package contains a simple TFormatFunction that convert log message into a valid XML format.

Installation

Using NPM.

npm i @project-reporter/xml-format

Using Yarn.

yarn add @project-reporter/xml-format

Usage Example

import { FileReporter } from '@project-reporter/file-reporter';
import { xmlFormat } from '@project-reporter/xml-format';

const reporter = new FileReporter(); // or any other logger.

reporter.setFormat(xmlFormat); // use it as a format function.

reporter.error(new Error('Something wrong'));

Example output

<Report>
  <Level>ERROR</Level>
  <Timestamp>YYYY-MM-DD HH:MM:SS</Timestamp>
  <Message>Something wrong</Message>
  <Stack>
    <Item>
      <File>internal/bootstrap/node.js</File>
      <Method>bootstrapNodeJSCore</Method>
      <Position>
        <Line>689</Line>
        <Column>30</Column>
      </Position>
    </Item>
    <!-- ... -->
  </Stack>
</Report>

Contributing

See Contribution Guidelines