refactor: Restructure monorepo to apps/server/ and apps/web/ layout
Move src/ → apps/server/ and packages/web/ → apps/web/ to adopt standard monorepo conventions (apps/ for runnable apps, packages/ for reusable libraries). Update all config files, shared package imports, test fixtures, and documentation to reflect new paths. Key fixes: - Update workspace config to ["apps/*", "packages/*"] - Update tsconfig.json rootDir/include for apps/server/ - Add apps/web/** to vitest exclude list - Update drizzle.config.ts schema path - Fix ensure-schema.ts migration path detection (3 levels up in dev, 2 levels up in dist) - Fix tests/integration/cli-server.test.ts import paths - Update packages/shared imports to apps/server/ paths - Update all docs/ files with new paths
This commit is contained in:
28
apps/server/logger/index.ts
Normal file
28
apps/server/logger/index.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import pino from 'pino';
|
||||
|
||||
function resolveLevel(): string {
|
||||
if (process.env.CW_LOG_LEVEL) return process.env.CW_LOG_LEVEL;
|
||||
return process.env.NODE_ENV === 'development' ? 'debug' : 'info';
|
||||
}
|
||||
|
||||
export const logger = pino(
|
||||
{
|
||||
name: 'cw',
|
||||
level: resolveLevel(),
|
||||
...(process.env.CW_LOG_PRETTY === '1' && {
|
||||
transport: {
|
||||
target: 'pino-pretty',
|
||||
options: {
|
||||
colorize: true,
|
||||
ignore: 'pid,hostname',
|
||||
translateTime: 'HH:MM:ss.l',
|
||||
},
|
||||
},
|
||||
}),
|
||||
},
|
||||
process.env.CW_LOG_PRETTY === '1' ? undefined : pino.destination(2),
|
||||
);
|
||||
|
||||
export function createModuleLogger(module: string) {
|
||||
return logger.child({ module });
|
||||
}
|
||||
Reference in New Issue
Block a user