updated some docs and removed some

This commit is contained in:
Bojan Kucera 2025-06-08 20:06:35 -04:00
parent 2aaeba2f6c
commit fe96cf6679
7 changed files with 109 additions and 734 deletions

View file

@ -1,6 +1,6 @@
# @stock-bot/logger
Enhanced logging library with Loki integration for the Stock Bot platform.
Enhanced logging library with Loki integration for the Stock Bot platform (June 2025).
## Features
@ -17,8 +17,8 @@ Enhanced logging library with Loki integration for the Stock Bot platform.
## Installation
```bash
cd libs/logger
npm install
# Using Bun (current runtime)
bun install
```
## Basic Usage
@ -38,17 +38,16 @@ logger.error('An error occurred', new Error('Something went wrong'));
### With Context
```typescript
import { Logger } from '@stock-bot/logger';
import { getLogger } from '@stock-bot/logger';
const logger = new Logger('trading-service', {
userId: '12345',
sessionId: 'abc-def-ghi'
});
const logger = getLogger('trading-service');
logger.info('Trade executed', {
symbol: 'AAPL',
quantity: 100,
price: 150.25
price: 150.25,
userId: '12345',
sessionId: 'abc-def-ghi'
});
```
@ -170,6 +169,8 @@ LOKI_BATCH_SIZE=1024
### Child Loggers
```typescript
import { getLogger } from '@stock-bot/logger';
const parentLogger = getLogger('trading-service');
const orderLogger = parentLogger.child({
module: 'order-processing',
@ -179,17 +180,13 @@ const orderLogger = parentLogger.child({
orderLogger.info('Order validated'); // Will include parent context
```
### Custom Transports
### Custom Configuration
```typescript
import { createLogger } from '@stock-bot/logger';
import { getLogger } from '@stock-bot/logger';
const logger = createLogger('custom-service', {
level: 'debug',
enableLoki: true,
enableFile: false,
enableConsole: true
});
// Uses standard getLogger with service-specific configuration
const logger = getLogger('custom-service');
```
### Sensitive Data Masking