1.2.33 • Published 6 months ago

@jacraig/woodchuck v1.2.33

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

WoodChuck - Logging Library

NPM Publish

WoodChuck is a versatile logging library for TypeScript/JavaScript that simplifies the process of logging messages within your applications and is built with structured event data at its heart. It provides a flexible and extensible logging framework to help you track and understand the flow of your application.

Features

  • Easy Integration: Simple setup for quick integration into your projects.

  • Customizable Logging Levels: Define and use different logging levels to categorize and filter messages.

  • Extensible Plugins: Extend functionality with plugins for various output formats and destinations.

  • Structured Logging: Log structured event data to make it easier to analyze and understand.

  • Flexible Configuration: Configure the logger with a fluent interface to customize the logging experience.

Installation

npm i @jacraig/woodchuck

Usage

  1. Configure the logger with a sink to output to.
import { Logger, ConsoleSink } from '@jacraig/woodchuck';

Logger.configure()
    .minimumLevel("Information")
    .writeTo(new ConsoleSink())
    .build();
  1. Log messages with different levels:
Logger.verbose("This is a verbose message: {key}", { "key": "value" });
Logger.debug("This is a debug message: {key}", { "key": "value" });
Logger.information("This is an information message: {key}", { "key": "value" });
Logger.warning("This is a warning message: {key}", { "key": "value" });
Logger.error("This is an error message: {key}", { "key": "value" }, new Error("This is an error"));
Logger.fatal("This is a fatal message: {key}", { "key": "value" }, new Error("This is a fatal error"));
  1. Customize the logger with plugins:
Logger.configure()
    .enrichWith(new UserAgentEnricher())
    .enrichWith(new UrlEnricher())
    .enrichWith(new CallerEnricher())
    .formatUsing(new DefaultFormatter())
    .minimumLevel("Information")
    .writeTo(new ConsoleSink());
  1. Or build your own plugins:
import { LogEventEnricher, LogEvent } from '@jacraig/woodchuck';

export class MyCustomPlugin implements LogEventEnricher {
    public enrich(logEvent: LogEvent): void {
        logEvent.properties["myProperty"] = "Something, something, something, dark side";
    }
}

Contributing

If you'd like to contribute to WoodChuck, please follow our contribution guidelines.

License

WoodChuck is licensed under the Apache 2 License.

1.2.0

12 months ago

1.2.8

10 months ago

1.2.7

10 months ago

1.2.6

11 months ago

1.2.5

11 months ago

1.2.4

11 months ago

1.2.3

11 months ago

1.2.2

12 months ago

1.2.1

12 months ago

1.2.12

9 months ago

1.2.13

9 months ago

1.2.10

10 months ago

1.2.11

10 months ago

1.2.16

9 months ago

1.2.17

8 months ago

1.2.14

9 months ago

1.2.15

9 months ago

1.2.18

8 months ago

1.2.19

8 months ago

1.1.5

12 months ago

1.1.4

12 months ago

1.1.3

1 year ago

1.2.20

8 months ago

1.2.23

8 months ago

1.2.24

7 months ago

1.2.21

8 months ago

1.2.22

8 months ago

1.2.27

7 months ago

1.2.28

7 months ago

1.2.25

7 months ago

1.2.26

7 months ago

1.2.29

6 months ago

1.2.30

6 months ago

1.2.31

6 months ago

1.2.9

10 months ago

1.2.32

6 months ago

1.2.33

6 months ago

1.1.2

1 year ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago