feat(logging): emit sanitized structured app logs

This commit is contained in:
Do Siki
2026-09-28 09:51:40 +02:00
parent 2ad3e75c87
commit b5a8936f42
26 changed files with 429 additions and 574 deletions
+1 -11
View File
@@ -74,9 +74,6 @@ jest.mock('winston', () => ({
}
}))
// Mock winston-loki
jest.mock('winston-loki', () => jest.fn().mockImplementation(() => ({ name: 'loki' })))
// Let individual test files handle their own logger mocks
// This allows for more specific testing of the logger module itself
@@ -133,12 +130,6 @@ if (!global.process.env) {
// Logger will be mocked by the winston mock above
// Mock Loki transport
jest.mock('winston-loki', () => jest.fn(() => ({
log: jest.fn(),
close: jest.fn()
})))
// Mock Next.js router
jest.mock('next/router', () => ({
useRouter: () => ({
@@ -261,7 +252,6 @@ global.NextResponse = {
// Set up environment variables for tests
process.env.MONGODB_URI = 'mongodb://localhost:27017/test'
process.env.MONGODB_DB = 'test'
process.env.LOKI_HOST = 'http://loki:3100'
process.env.NODE_ENV = 'test'
process.env.NEXT_PUBLIC_CONTACT_EMAIL = 'info@mozdit.hu'
process.env.NEXT_PUBLIC_SITE_URL = 'https://localhost:3000'
@@ -274,4 +264,4 @@ afterEach(() => {
})
// Import React Testing Library DOM (using require for Jest setup files)
require('@testing-library/jest-dom')
require('@testing-library/jest-dom')