Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

logpipes

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

logpipes

Console.log transformation pipes

  • 1.10.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
19K
decreased by-0.13%
Maintainers
1
Weekly downloads
 
Created
Source

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:

  • JsonSimplifierOptions
  • JsonPipeOptions

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

Keywords

FAQs

Package last updated on 13 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc