https://github.com/tsledger/ledger
(Unstable/Alpha) Batteries-included TypeScript-first Logging Framework on JSR. Compatible with Deno and Node.js
https://github.com/tsledger/ledger
deno jsr logging nodejs typescript
Last synced: about 2 months ago
JSON representation
(Unstable/Alpha) Batteries-included TypeScript-first Logging Framework on JSR. Compatible with Deno and Node.js
- Host: GitHub
- URL: https://github.com/tsledger/ledger
- Owner: TSLedger
- License: mit
- Created: 2024-10-02T23:27:01.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-20T14:15:02.000Z (over 1 year ago)
- Last Synced: 2025-04-04T11:48:00.865Z (about 1 year ago)
- Topics: deno, jsr, logging, nodejs, typescript
- Language: TypeScript
- Homepage:
- Size: 422 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
## What is Ledger?
> [!CAUTION]
> This Library is a Work in Progress and is NOT ready for production use. APIs are subject to change and breakage.
Welcome to Ledger, a batteries-included TypeScript-first Logging Framework on JSR. Compatible with Deno and Node.js. Themed to a Ledger of Records
Ledger provides the structure to create or utilize a Handler to process loggable events. These transports can range from stdout, file-backed, or even pure HTTP Requests for any vendor. Anything that is possible with in TypeScript is possible to do in Ledger.
## What is a Handler?
A Ledger Handler is simply a managed worker instance that receives a payload from the Ledger API. You can leverage an infinite amount of Handlers all working side-by-side. You can utilize pre-built Handlers or publish one you create.
We recommend publishing Handlers to JSR.
Features:
- Handlers using a Worker reduces the burden of Event Loop and enables async functionality.
- Handlers will automatically restore in the event of a critical failure.
## Getting Started
If you are ready to give Ledger a try, you can get started with a snippet such as the below:
```ts
import { Ledger } from 'jsr:@ledger/ledger';
// Initialize Ledger
const ledger = new Ledger({
useAsyncDispatchQueue: true, // or false for ImmediateDispatch mode.
});
// Register a Handler. You can chain these too!
ledger.register({
definition: 'jsr:@ledger/console-handler@0.0.0', // Version is Important. Please verify the latest version. See: https://jsr.io/@ledger for official handlers.
});
// Await Ledger to be alive and functional.
await ledger.alive();
// ledger.trace, ledger.information, ledger.warning, ledger.severe
ledger.information('Hello, world');
// Eventually...
ledger.terminate();
```
## Additional Documentation
Please visit the JSR Symbol Documentation at [JSR Docs](https://jsr.io/@ledger/ledger/doc) or the [GitHub Wiki](https://github.com/TSLedger/ledger/wiki) for additional examples and handler documentation.
## Support
Please use GitHub [Issues](https://github.com/TSLedger/ledger/issues) or [Discussions](https://github.com/TSLedger/ledger/discussions).
## Acknowledgements
[pinojs/pino](https://github.com/pinojs/pino) - Foundational Model and Worker Concepts