Git Product home page Git Product logo

logging-js's Introduction

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.

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.

logging-js's People

Contributors

fryuni avatar guipfernandes avatar marcospassos avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

logging-js's Issues

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: Cannot find preset's package (github>croct-tech/renovate-presets:js)

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Repository problems

These problems occurred while renovating this repository. View logs.

  • WARN: File contents are invalid JSON but parse using JSON5. Support for this will be removed in a future release so please change to a support .json5 file name or ensure correct JSON syntax.

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • Update dependency eslint to v9
  • Lock file maintenance

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/check-commit-style.yml
  • mristin/opinionated-commit-message v3.1.0
.github/workflows/check-required-labels.yaml
.github/workflows/deploy-release.yaml
  • actions/checkout v4
  • actions/setup-node v4
  • actions/cache v4
.github/workflows/send-guidelines.yaml
  • wow-actions/auto-comment v1
.github/workflows/update-release-notes.yaml
  • release-drafter/release-drafter v6
.github/workflows/validate-branch.yaml
  • actions/checkout v4
  • actions/setup-node v4
  • actions/cache v4
  • actions/checkout v4
  • actions/setup-node v4
  • actions/cache v4
  • actions/checkout v4
  • actions/setup-node v4
  • actions/cache v4
  • actions/checkout v4
  • actions/setup-node v4
  • actions/cache v4
  • paambaati/codeclimate-action v6.0.0
npm
package.json
  • @croct/json ^2.0.1
  • @croct/eslint-plugin ^0.7.0
  • @types/jest ^29.0.0
  • @typescript-eslint/parser ^7.0.0
  • eslint ^9.0.0
  • jest ^29.0.0
  • ts-jest ^29.0.0
  • typescript ^5.0.0

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.