implemented performance profiling into some areas
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
||||
export type LogDepth = 'normal' | 'verbose';
|
||||
export type LogType = 'http' | 'app' | 'auth';
|
||||
export type LogDepth = 'normal' | 'verbose' | 'profiling';
|
||||
export type LogType = 'http' | 'app' | 'auth' | 'profiling';
|
||||
|
||||
export interface LogHeader {
|
||||
timestamp: string;
|
||||
@@ -18,7 +18,7 @@ export interface LogPayload {
|
||||
// Environment defaults
|
||||
const CURRENT_DEPTH: LogDepth = (process.env.LOG_DEPTH as LogDepth) || 'normal';
|
||||
|
||||
const DEPTH_ORDER: Record<LogDepth, number> = { normal: 0, verbose: 1 };
|
||||
const DEPTH_ORDER: Record<LogDepth, number> = { normal: 0, verbose: 1, profiling: 2 };
|
||||
|
||||
function shouldLog(depth: LogDepth) {
|
||||
let should = DEPTH_ORDER[depth] <= DEPTH_ORDER[CURRENT_DEPTH]
|
||||
|
||||
Reference in New Issue
Block a user