Skip to content

A modular logger using HMAC to secure log integrity.

License

Notifications You must be signed in to change notification settings

StevenSermeus/logcm

Repository files navigation

logcm

A modular logger for javascript/typescript projects. This logger can be used to log messages to the console, file, database, etc. You can easily add new providers by extending the Provider class. The logger can be configured to log messages in a specific format. The log integrity can be ensured by using a secret key to add a hmac signature to the log messages.

Usage/Examples

The logger can be used in the following way:

import { Logger } from "logcm";
import {
  ConsoleProvider,
  FileProvider,
  DiscordProvider,
} from "logcm/providers";

const logger = Logger.getLogger(
  "[TYPE] HH:MI:SS:MS DD/MM/YYYY TZ MSG",
  [
    new DiscordProvider({
      webhookUrl: "discord webhook url",
    }),
    new FileProvider(),
    new ConsoleProvider(),
  ],
  process.env.SECRET,
);

logger.info("This is an info message");

logger.warn("This is a warning message");

logger.debug("This is a debug message");

logger.critical("This is a critical message");

logger.error("This is an error message");

Installation

Install logcm with npm, pnpm or yarn

  npm install logcm
  yarn add logcm
  pnpm add logcm

Contributing

Contributions are always welcome!

See contributing.md for ways to get started.

Please adhere to this project's code of conduct.

Authors

Roadmap

  • Add more providers.

  • Auto deploy the documentation to github pages.

About

A modular logger using HMAC to secure log integrity.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published