1.10.2 • Published 2 months ago

logpipes v1.10.2

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 months ago

logpipes

Transforms console.log ('debug', 'error', 'info', 'log', 'trace', 'warn') method output with chainable pipes.

Comes with a ready-to-use implementation of different pipes, like 'JsonStringifyPipe': a pipe that transforms console output into a single serialized JSON string.

TypeScript safe. Has zero external dependencies.

Usage example:

import {installConsoleOverrides} from 'logpipes';

installConsoleOverrides(createJsonStringifyPipe());
console.log('Log after pipe is installed', {a: 1, b: 2, c: 3});

Produces a one-liner string with a serialized JSON:

'{"message":"Log after pipe is installed $1","$1":{"a":1,"b":2,"c":3},"level":"log","timestamp":"2023-07-03T17:13:56.018Z","id":"current-log-message-uuid"}'

Pipes

JsonPipe

JsonPipe converts console log arguments into a single serializable JSON object.

The pipe accepts JsonPipeOptions which inherits all JsonSimplifierOptions.

See in-code docs for the available options:

Check unit tests for more examples.

JsonStringifyPipe

JsonStringifyPipe calls JsonPipe and converts the result JSON object into a single line string.

See docs for JsonPipe for more details.

LogLevelFilterPipe

LogLevelFilterPipe excludes configured log levels from the final output.

See LogLevelFilterPipeOptions and related unit tests.

LogMessageFilterPipe

LogMessageFilterPipe excludes configured all log events with a specified tokens in the message.

See LogMessageFilterPipeOptions and related unit tests.

LogCachePipe

LogCachePipe caches console messages and provides access to the cache.

This pipe can be used to dump or sideload all console log messages.

See LogCachePipeOptions and related unit tests.

DateTimePipe

Adds a timestamp as the first parameter to every console message.

NoopPipe

NoopPipe does nothing and proxies all parameters to the next pipe with no changes.

It can be used to reduce a client-side boilerplate code.

Utility methods and types

1.10.2

2 months ago

1.10.1

2 months ago

1.10.0

8 months ago

1.9.1

9 months ago

1.9.0

9 months ago

1.8.3

9 months ago

1.8.2

9 months ago

1.8.1

9 months ago

1.8.0

9 months ago

1.7.0

9 months ago

1.6.1

10 months ago

1.6.0

10 months ago

1.5.0

10 months ago

1.4.0

10 months ago

1.3.1

10 months ago

1.3.0

10 months ago

1.2.1

10 months ago

1.2.0

10 months ago

1.1.4

10 months ago

1.1.3

10 months ago

1.1.2

10 months ago

1.1.1

10 months ago

1.1.0

10 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago

0.0.1

10 months ago