()
| 134 | } |
| 135 | |
| 136 | function getAppLogRedactionPatterns(): RegExp[] { |
| 137 | const raw = process.env.AGENT_DEVICE_APP_LOG_REDACT_PATTERNS; |
| 138 | if (!raw) return []; |
| 139 | const patterns = raw |
| 140 | .split(',') |
| 141 | .map((part) => part.trim()) |
| 142 | .filter((part) => part.length > 0); |
| 143 | const result: RegExp[] = []; |
| 144 | for (const pattern of patterns) { |
| 145 | try { |
| 146 | result.push(new RegExp(pattern, 'gi')); |
| 147 | } catch { |
| 148 | // Skip invalid user pattern. |
| 149 | } |
| 150 | } |
| 151 | return result; |
| 152 | } |
| 153 | |
| 154 | export function rotateAppLogIfNeeded( |
| 155 | outPath: string, |
no test coverage detected