(text: string, options?: LoggerOptions)
| 99 | } |
| 100 | |
| 101 | export function writeLog(text: string, options?: LoggerOptions) { |
| 102 | if (!logsDirectory) throw new Error('Missing log file directory.'); |
| 103 | |
| 104 | const safeText = options?.secrets ? replaceSecrets(text, secrets) : text; |
| 105 | // Strip ANSI characters to write tables to log files correctly and add new line |
| 106 | const sanitizedLogs = ANSI_REGEX.test(safeText) ? '\n' + safeText.replace(ANSI_REGEX, '') : safeText; |
| 107 | fs.appendFileSync( |
| 108 | path.join(logsDirectory, `deployer-${logFileTimestamp}.log`), |
| 109 | `${new Date().toISOString()}: ${sanitizedLogs}\n` |
| 110 | ); |
| 111 | } |
| 112 | |
| 113 | export function succeed(text: string, options?: LoggerOptions) { |
| 114 | writeLog(text, options); |
no test coverage detected