@volontariapp/logger 0.2.5 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +23 -23
  3. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.7
4
+
5
+ ### Patch Changes
6
+
7
+ - README bump
8
+
9
+ ## 0.2.6
10
+
11
+ ### Patch Changes
12
+
13
+ - README bump
14
+
3
15
  ## 0.2.5
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @volontariapp/logger
2
2
 
3
- A cross-platform logging utility that works seamlessly in NodeJS, NestJS, and React Native. It outputs beautifully structured JSON logs or colored plain text logs based on the execution environment.
3
+ Un utilitaire de log cross-platform qui fonctionne parfaitement sur NodeJS, NestJS et React Native. Il génère des logs JSON structurés ou des logs texte colorés selon l'environnement d'exécution.
4
4
 
5
5
  ## Installation
6
6
 
@@ -8,13 +8,13 @@ A cross-platform logging utility that works seamlessly in NodeJS, NestJS, and Re
8
8
  npm install @volontariapp/logger
9
9
  ```
10
10
 
11
- ## Setup & Configuration
11
+ ## Configuration & Mise en place
12
12
 
13
- This logger is highly versatile and supports different instantiation strategies depending on the platform you're targeting.
13
+ Ce logger est très polyvalent et supporte différentes stratégies d'instanciation en fonction de la plateforme ciblée.
14
14
 
15
- ### 1. NodeJS Project
15
+ ### 1. Projet NodeJS
16
16
 
17
- For a typical NodeJS application or script, you can instantiate the logger directly. We recommend using `text` format for local development and `json` format in production.
17
+ Pour une application ou un script NodeJS classique, vous pouvez instancier le logger directement. Nous recommandons d'utiliser le format `text` pour le développement local et `json` en production.
18
18
 
19
19
  ```typescript
20
20
  import { Logger } from '@volontariapp/logger';
@@ -25,22 +25,22 @@ const logger = new Logger({
25
25
  minLevel: 'info', // 'debug' | 'info' | 'warn' | 'error' | 'fatal'
26
26
  });
27
27
 
28
- logger.info('Worker initialized successfully.');
29
- logger.error('Failed to sync data.', new Error('Connection timeout'));
28
+ logger.info('Worker initialisé avec succès.');
29
+ logger.error('Échec de synchronisation des données.', new Error('Connection timeout'));
30
30
  ```
31
31
 
32
- ### 2. NestJS Project
32
+ ### 2. Projet NestJS
33
33
 
34
- The logger adheres to NestJS's `LoggerService` interface out of the box (`log`, `error`, `warn`, `debug`, `verbose`). You can use it as a custom application-wide logger as well as via dependency injection.
34
+ Le logger respecte l'interface `LoggerService` de NestJS de manière native (`log`, `error`, `warn`, `debug`, `verbose`). Vous pouvez l'utiliser comme logger global de l'application ou via l'injection de dépendances.
35
35
 
36
- **Application Bootstrap** (`main.ts`):
36
+ **Initialisation de l'Application** (`main.ts`) :
37
37
  ```typescript
38
38
  import { NestFactory } from '@nestjs/core';
39
39
  import { AppModule } from './app.module';
40
40
  import { Logger } from '@volontariapp/logger';
41
41
 
42
42
  async function bootstrap() {
43
- // Use JSON formatting for structured logging in NestJS apps
43
+ // Utilise le format JSON pour des logs structurés dans les applications NestJS
44
44
  const appLogger = new Logger({ format: 'json', context: 'NestApplication' });
45
45
 
46
46
  const app = await NestFactory.create(AppModule, {
@@ -52,7 +52,7 @@ async function bootstrap() {
52
52
  bootstrap();
53
53
  ```
54
54
 
55
- **Dependency Injection Module** (`logger.module.ts`):
55
+ **Module d'Injection de Dépendances** (`logger.module.ts`) :
56
56
  ```typescript
57
57
  import { Module, Global } from '@nestjs/common';
58
58
  import { Logger } from '@volontariapp/logger';
@@ -72,34 +72,34 @@ const customLogger = new Logger({ format: 'json', context: 'RequestScope' });
72
72
  export class LoggerModule {}
73
73
  ```
74
74
 
75
- ### 3. React Native Project
75
+ ### 3. Projet React Native
76
76
 
77
- In React Native, it is often easier to read text logs in Metro Bundler, rather than a full JSON object. You can instantiate it locally to your specific component or as a Singleton for the entire app.
77
+ Sur React Native, il est souvent plus simple de lire des logs texte dans la console Metro Bundler plutôt qu'un objet JSON complet. Vous pouvez l'instancier localement pour un composant spécifique ou en Singleton pour toute l'application.
78
78
 
79
79
  ```typescript
80
80
  import { Logger } from '@volontariapp/logger';
81
81
 
82
82
  export const logger = new Logger({
83
83
  context: 'MobileApp',
84
- format: 'text', // Recommended for reacting native metro bundler console
84
+ format: 'text', // Recommandé pour la console metro bundler de react native
85
85
  minLevel: 'debug',
86
86
  });
87
87
 
88
- // Inside a React Component
88
+ // À l'intérieur d'un composant React
89
89
  export const HomeScreen = () => {
90
- logger.debug('HomeScreen mounted', { timestamp: Date.now() });
90
+ logger.debug('HomeScreen monté', { timestamp: Date.now() });
91
91
 
92
92
  const handlePress = () => {
93
- logger.info('Button pressed');
93
+ logger.info('Bouton cliqué');
94
94
  };
95
95
 
96
96
  return <Action handlePress={handlePress} />;
97
97
  };
98
98
  ```
99
99
 
100
- ## Features
100
+ ## Fonctionnalités
101
101
 
102
- - **JSON & Text Output**: Switch formats based on the environment (`json` for Grafana/ELK, `text` for local development).
103
- - **Log Levels**: Standard levels (`debug`, `info`, `warn`, `error`, `fatal`).
104
- - **NestJS Compatible**: `log` and `verbose` wrappers ensure NestJS interface compatibility.
105
- - **Micro-metadata**: Pass specific metadata objects simply. `logger.info('User Login', { userId: 1 })`.
102
+ - **Sortie JSON & Texte** : Changez de format selon l'environnement (`json` pour Grafana/ELK, `text` pour le dev local).
103
+ - **Niveaux de Log** : Niveaux standards (`debug`, `info`, `warn`, `error`, `fatal`).
104
+ - **Compatible NestJS** : Les méthodes `log` et `verbose` garantissent la compatibilité avec l'interface NestJS.
105
+ - **Micro-metadata** : Passez facilement des objets de métadonnées. `logger.info('User Login', { userId: 1 })`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volontariapp/logger",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -37,7 +37,7 @@
37
37
  "@jest/globals": "^30.3.0",
38
38
  "@types/jest": "^30.0.0",
39
39
  "@types/node": "^25.5.2",
40
- "@volontariapp/testing": "1.0.1",
40
+ "@volontariapp/testing": "1.0.3",
41
41
  "jest": "^30.3.0",
42
42
  "ts-jest": "^29.4.9",
43
43
  "typescript": "5.7.3"