MCPcopy Create free account
hub / github.com/Roy3838/Observer / parseLine

Method parseLine

app/src/utils/broadcastLogService.ts:73–102  ·  view source on GitHub ↗

* Parse a log line and emit to Logger

(line: string)

Source from the content-addressed store, hash-verified

71 * Parse a log line and emit to Logger
72 */
73 private parseLine(line: string) {
74 // Format: [timestamp] message
75 // Example: [2026-02-27T22:07:25Z] SampleHandler init
76
77 const match = line.match(/^\[([^\]]+)\]\s*(.*)$/);
78 if (!match) {
79 // Non-standard format, log as-is
80 Logger.debug('BROADCAST', line);
81 return;
82 }
83
84 const [, timestamp, message] = match;
85
86 // Determine log level based on message content
87 let level = LogLevel.DEBUG;
88 if (message.startsWith('❌')) {
89 level = LogLevel.ERROR;
90 } else if (message.startsWith('✅')) {
91 level = LogLevel.INFO;
92 } else if (message.includes('error') || message.includes('Error')) {
93 level = LogLevel.ERROR;
94 } else if (message.includes('warning') || message.includes('Warning')) {
95 level = LogLevel.WARNING;
96 }
97
98 Logger.log(level, 'BROADCAST', message, {
99 logType: 'broadcast-extension',
100 timestamp: timestamp
101 });
102 }
103
104 /**
105 * Get the App Group path (for debugging)

Callers 1

pollMethod · 0.95

Calls 2

debugMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected