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

@croct/logging

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@croct/logging

An interoperability layer for logging libraries.

  • 0.2.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

Croct
Logging
An interoperability layer for logging libraries.

Version Build

📦 Releases · 🐞 Report Bug · ✨ Request Feature

Installation

We recommend using NPM to install the package:

npm install @croct/logging

Basic usage

The following example shows how to log a message using the ConsoleLogger:

import {ConsoleLogger, LogLevel} from '@croct/logging';

const logger = new ConsoleLogger();

logger.log({
    level: LogLevel.ERROR,
    message: 'Unable to load data',
    details: { 
        cause: 'The request failed',
        status: 500,
    },
});

Implementations

This package provides the following implementations:

  • SuppressedLogger
    A logger that does not log anything, but can be used to suppress logging where desired.
  • ConsoleLogger
    A logger that writes to the console using the appropriate console API semantics.
  • PrefixedLogger
    A logger that prepends a prefix to all log messages.
  • InMemoryLogger
    A logger that stores all log messages in memory.
  • MultiLogger
    A logger that sends logs to multiple loggers.
  • FilteredLogger
    A logger wrapper that filters logs according to log level.

Utilities

Because JavaScript allows throwing pretty much anything, proving more information about the error often requires some boilerplate code.

This package provides a few utilities to make it easier to log errors:

Contributing

Contributions to the package are always welcome!

  • Report any bugs or issues on the issue tracker.
  • For major changes, please open an issue first to discuss what you would like to change.
  • Please make sure to update tests as appropriate.

Testing

Before running the test suites, the development dependencies must be installed:

npm install

Then, to run all tests:

npm run test

Run the following command to check the code against the style guide:

npm run lint

Building

Before building the project, the dependencies must be installed:

npm install

Then, to build the CommonJS module:

npm run build

License

Copyright © 2015-2022 Croct Limited, All Rights Reserved.

All information contained herein is, and remains the property of Croct Limited. The intellectual, design and technical concepts contained herein are proprietary to Croct Limited s and may be covered by U.S. and Foreign Patents, patents in process, and are protected by trade secret or copyright law. Dissemination of this information or reproduction of this material is strictly forbidden unless prior written permission is obtained from Croct Limited.

Keywords

FAQs

Package last updated on 04 Nov 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