Skip to content

Commit aa50200

Browse files
committed
refactor(logger): replace observability logger with a dedicated logger plugin and update related imports across the codebase; remove deprecated observability logger files
1 parent a076ce7 commit aa50200

File tree

95 files changed

+586
-1899
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+586
-1899
lines changed

.claude/settings.local.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
"Bash(node dist/cli.js:*)",
2424
"Bash(npx tsc:*)",
2525
"Bash(node -e:*)",
26-
"Bash(cat:*)"
26+
"Bash(cat:*)",
27+
"Bash(pnpm tbk generate:plugin:*)",
28+
"Bash(find:*)",
29+
"Bash(timeout 15 pnpm start:dev:*)"
2730
],
2831
"deny": [],
2932
"ask": []

.cursor/rules/controllers.mdc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ StatusCodes.INTERNAL_SERVER_ERROR; // 500
369369
Use Pino logger from [logger.ts](mdc:src/plugins/observability/logger.ts):
370370

371371
```typescript
372-
import logger from '@/plugins/observability/logger';
372+
import logger from '@/plugins/logger';
373373

374374
logger.info('Action performed', { userId, action: 'create' });
375375
logger.error('Error occurred', { error: error.message, userId });

.cursor/rules/development.mdc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ curl -X POST http://localhost:3000/api/auth/login \
196196
Logs use Pino logger from [logger.ts](mdc:src/plugins/observability/logger.ts):
197197

198198
```typescript
199-
import { logger } from '@/plugins/observability/logger';
199+
import { logger } from '@/plugins/logger';
200200

201201
logger.info('Info message', { data });
202202
logger.error('Error message', { error });

.cursor/rules/email.mdc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ View:
370370
Check email sending logs:
371371

372372
```typescript
373-
import { logger } from '@/plugins/observability/logger';
373+
import { logger } from '@/plugins/logger';
374374

375375
// Logs are automatically added by email service
376376
logger.info('Email sent', { to, template });

.cursor/rules/services.mdc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Services contain business logic, database operations, external API calls, and co
1313

1414
```typescript
1515
import { Model } from './module.model';
16-
import { logger } from '@/plugins/observability/logger';
16+
import { logger } from '@/plugins/logger';
1717
import type { CreateInput, UpdateInput } from './module.dto';
1818

1919
/**
@@ -365,7 +365,7 @@ export const processComplexOperation = async (data: any) => {
365365
Use Pino logger:
366366

367367
```typescript
368-
import { logger } from '@/plugins/observability/logger';
368+
import { logger } from '@/plugins/logger';
369369

370370
logger.info('Operation performed', { userId, itemId });
371371
logger.error('Error occurred', { error: err.message, stack: err.stack });

CLAUDE.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ export interface ToolkitPlugin {
183183
```
184184

185185
**Built-in plugins:**
186-
- **observability** - Pino logger, metrics (Prometheus), request IDs
186+
- **logger** - Pino logger with pretty printing, HTTP request logging, child logger factory
187+
- **observability** - Metrics (Prometheus), request IDs, health checks
187188
- **security** - Helmet, CORS, rate limiting
188189
- **cache** - Redis/memory caching with middleware
189190
- **magic** - MagicRouter, OpenAPI generation, response validation
@@ -250,7 +251,7 @@ export const create = async (data: CreateInput) => {
250251
- Services throw errors with `statusCode` property for HTTP status codes
251252
- Controllers decide how to handle null returns
252253
- Never import Express types (Request/Response) in services
253-
- Use logger from `@/plugins/observability/logger`
254+
- Use logger from `@/plugins/logger`
254255

255256
### File Uploads with Formidable
256257

@@ -356,7 +357,7 @@ This scaffolds all 6 files following project patterns. After generation:
356357
TypeScript paths configured in `tsconfig.json`:
357358
- `@/*` resolves to `./src/*`
358359

359-
Example: `import { logger } from '@/plugins/observability/logger'`
360+
Example: `import { logger } from '@/plugins/logger'`
360361

361362
### MongoDB ID Validation
362363

@@ -423,6 +424,7 @@ Models are introspected and rendered with full CRUD. Configure admin access in `
423424
- `src/lib/storage.ts` - S3/R2/local file storage
424425
- `src/lib/queue.ts` - BullMQ queue configuration
425426
- `src/email/email.service.ts` - Email sending (SMTP/Resend/Mailgun)
427+
- `src/plugins/logger/index.ts` - Logger plugin with Pino, HTTP logging, child logger factory
426428
- `src/plugins/magic/router.ts` - MagicRouter implementation
427429
- `src/plugins/magic/response.builders.ts` - Response schema builders (R.success, etc.)
428430
- `src/middlewares/can-access.ts` - JWT authentication middleware

0 commit comments

Comments
 (0)