-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathlogger.ts
More file actions
72 lines (63 loc) · 2.09 KB
/
Copy pathlogger.ts
File metadata and controls
72 lines (63 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
/**
* Logger Contract
*
* Defines the interface for logging in ObjectStack.
* Compatible with both browser console and structured logging systems.
*/
export interface Logger {
/**
* Log a debug message
* @param message - The message to log
* @param meta - Optional metadata to include
*/
debug(message: string, meta?: Record<string, any>): void;
/**
* Log an informational message
* @param message - The message to log
* @param meta - Optional metadata to include
*/
info(message: string, meta?: Record<string, any>): void;
/**
* Log a warning message
* @param message - The message to log
* @param meta - Optional metadata to include
*/
warn(message: string, meta?: Record<string, any>): void;
/**
* Log an error message
* @param message - The message to log
* @param error - Optional error object
* @param meta - Optional metadata to include
*/
error(message: string, error?: Error, meta?: Record<string, any>): void;
/**
* Log a fatal error message
* @param message - The message to log
* @param error - Optional error object
* @param meta - Optional metadata to include
*/
fatal?(message: string, error?: Error, meta?: Record<string, any>): void;
/**
* Create a child logger with additional context
* @param context - Context to add to all logs from this child
*/
child?(context: Record<string, any>): Logger;
/**
* Set trace context for distributed tracing
* @param traceId - Trace identifier
* @param spanId - Span identifier
*/
withTrace?(traceId: string, spanId?: string): Logger;
/**
* Compatibility method for console.log usage
* @param message - The message to log
* @param args - Additional arguments
*/
log?(message: string, ...args: any[]): void;
/**
* Cleanup resources (close file streams, etc.)
* Should be called when the logger is no longer needed
*/
destroy?(): Promise<void>;
}