- Updated address retrieval in user service to replace billing info with a dedicated address method. - Adjusted API endpoints to use `PATCH /api/me/address` for address updates instead of billing updates. - Enhanced documentation to reflect changes in address management processes and API usage. - Removed deprecated types and services related to billing address handling, streamlining the codebase.
1.7 KiB
1.7 KiB
Simple Centralized Logging
✅ Single Pino Logger Everywhere
We now use one simple Pino logger across the entire application:
- Frontend (Portal): Uses the same Pino logger
- Backend (BFF): Uses
nestjs-pinowith the same configuration - Shared: Single logger configuration
🚀 Usage Examples
Frontend (Portal)
import { logger, log } from "@/lib/logger";
// Simple logging
log.info("User logged in", { userId: "123" });
log.error("API call failed", error);
// Direct Pino usage
logger.info({ userId: "123" }, "User logged in");
Backend (BFF) - Dependency Injection
import { Logger } from "nestjs-pino";
@Injectable()
export class UserService {
constructor(@Inject(Logger) private readonly logger: Logger) {}
async findUser(id: string) {
this.logger.info({ userId: id }, "Finding user");
}
}
Backend (BFF) - Direct Import
import { logger, log } from "@customer-portal/domain";
// Simple logging
log.info("Service started");
log.error("Database error", error);
// Direct Pino usage
logger.info({ userId: "123" }, "User action");
🔧 Configuration
All configuration is in one place: packages/shared/src/logger.ts
- Development: Pretty printed logs with colors
- Production: JSON logs for log aggregation
- Browser: Console-friendly output
- Security: Automatic redaction of sensitive fields
🎯 Benefits
- ✅ One logger instead of multiple complex systems
- ✅ Same configuration everywhere
- ✅ No more fs/promises errors
- ✅ Simple imports - just
import { log } from "@customer-portal/domain" - ✅ Production ready with automatic security redaction