Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions shared-utils/logger/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
dist/
coverage/
28 changes: 28 additions & 0 deletions shared-utils/logger/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Structured Logger Utility (PoC)

A standalone, decoupled Centralized Structured Logger for the TAP Buddy application.

## Features
- **Context Tagging**: Initialize with a context string (e.g. `AuthModule`) to easily trace logs.
- **Severity Filtering**: Support for `DEBUG`, `INFO`, `WARN`, and `ERROR` levels with global and instance-level thresholds.
- **Pluggable Transports**: By default, outputs beautifully formatted logs to the console. Can easily inject custom transports (e.g., Sentry, Crashlytics) for production environments via `Logger.setGlobalTransport()`.
- **Zero Dependencies**: Core logic is implemented with pure TypeScript.

## Quickstart

```typescript
import { Logger } from 'structured-logger';

// Initialize with context
const logger = new Logger('SyncEngine');

logger.info('Starting sync process...', { userId: '123' });
logger.error('Failed to connect to server');
```

## Running Tests
This package is fully covered by a Jest test suite (100% coverage).
```bash
npm install
npm test
```
15 changes: 15 additions & 0 deletions shared-utils/logger/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
testMatch: ['**/tests/**/*.test.ts'],
collectCoverage: true,
coverageDirectory: 'coverage',
coverageThreshold: {
global: {
branches: 90,
functions: 90,
lines: 90,
statements: 90
}
}
};
Loading