Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/3axap4ehko/loggry
https://github.com/3axap4ehko/loggry
Last synced: 18 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/3axap4ehko/loggry
- Owner: 3axap4eHko
- License: other
- Created: 2021-11-20T03:16:44.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2024-10-24T00:10:24.000Z (22 days ago)
- Last Synced: 2024-10-24T13:59:22.985Z (22 days ago)
- Language: TypeScript
- Size: 769 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# LOGGRY
Lightweight 0-dependency, transport agnostic, ESM and CommonJS logger bus for Node.js applications,
enabling structured logging and event handling with customizable listeners and various log levels.[![Build Status][github-image]][github-url]
[![NPM version][npm-image]][npm-url]
[![Downloads][downloads-image]][npm-url]
[![Coverage Status][codecov-image]][codecov-url]
[![Maintainability][codeclimate-image]][codeclimate-url]
[![Snyk][snyk-image]][snyk-url]## Instalation
PNPM
```bash
pnpm add loggry
```YARN
```bash
yarn add loggry
```NPM
```bash
npm install --save loggry
```## Usage
In the main script
```typescript
import { addListener, LogEvent } from 'loggry';addListener((log: LogEvent) => console.log(log.level, log.message, 'at', log.timestamp));
```In some other place
```typescript
import { debug } from 'loggry';function myFunction() {
debug('myFunction', 'executed!');
}
```Built-in log levels
```typescript
enum LogLevel {
silent,
fatal,
error,
warn,
info,
debug,
trace,
}
```Pino integration
```typescript
import createPino from 'pino';
import { addListener, LogEvent } from 'loggry';const pinoLogger = createPino();
addListener(({ level, message, details }: LogEvent) => pinoLogger[level]({ details }, message));
```## License
License [Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0)
Copyright (c) 2023 Ivan Zakharchanka[npm-url]: https://www.npmjs.com/package/loggry
[downloads-image]: https://img.shields.io/npm/dw/loggry.svg?maxAge=43200
[npm-image]: https://img.shields.io/npm/v/loggry.svg?maxAge=43200
[github-url]: https://github.com/3axap4eHko/loggry/actions/workflows/cicd.yml
[github-image]: https://github.com/3axap4eHko/loggry/actions/workflows/cicd.yml/badge.svg
[codecov-url]: https://codecov.io/gh/3axap4eHko/loggry
[codecov-image]: https://codecov.io/gh/3axap4eHko/loggry/branch/master/graph/badge.svg?token=JZ8QCGH6PI
[codeclimate-url]: https://codeclimate.com/github/3axap4eHko/loggry/maintainability
[codeclimate-image]: https://api.codeclimate.com/v1/badges/0ba20f27f6db2b0fec8c/maintainability
[snyk-url]: https://snyk.io/test/npm/loggry/latest
[snyk-image]: https://img.shields.io/snyk/vulnerabilities/github/3axap4eHko/loggry.svg?maxAge=43200