feat: implement structured logging for server and client
Server: - Add pino and pino-http for structured logging - Create @Logged class decorator using Proxy pattern for automatic method logging - Add pino redact config for sensitive data (password, token, etc.) - Move AuthMiddleware to controllers folder (per architecture diagram) - Add LoggingMiddleware for HTTP request logging - Replace console.log/error with structured logger in controllers and app.ts - Decorate all repositories and GPTAdapter with @Logged Client: - Add react-native-logs with namespaced loggers (apiLogger, storeLogger) - Add request/response logging to ApiClient with duration tracking
This commit is contained in:
@@ -6,8 +6,10 @@ import {
|
||||
UpdateMessageDTO,
|
||||
} from "@caldav/shared";
|
||||
import { ChatRepository } from "../../services/interfaces";
|
||||
import { Logged } from "../../logging";
|
||||
import { ChatMessageModel, ConversationModel } from "./models";
|
||||
|
||||
@Logged("MongoChatRepository")
|
||||
export class MongoChatRepository implements ChatRepository {
|
||||
// Conversations
|
||||
async getConversationsByUser(userId: string): Promise<Conversation[]> {
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { CalendarEvent, CreateEventDTO, UpdateEventDTO } from "@caldav/shared";
|
||||
import { EventRepository } from "../../services/interfaces";
|
||||
import { Logged } from "../../logging";
|
||||
import { EventModel } from "./models";
|
||||
|
||||
@Logged("MongoEventRepository")
|
||||
export class MongoEventRepository implements EventRepository {
|
||||
async findById(id: string): Promise<CalendarEvent | null> {
|
||||
const event = await EventModel.findById(id);
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { User } from "@caldav/shared";
|
||||
import { UserRepository, CreateUserData } from "../../services/interfaces";
|
||||
import { Logged } from "../../logging";
|
||||
import { UserModel } from "./models";
|
||||
|
||||
@Logged("MongoUserRepository")
|
||||
export class MongoUserRepository implements UserRepository {
|
||||
async findById(id: string): Promise<User | null> {
|
||||
throw new Error("Not implemented");
|
||||
|
||||
Reference in New Issue
Block a user