(str: string)
| 27 | const logFsPath = getLogPath(); |
| 28 | |
| 29 | function OpenOCDLog(str: string) { |
| 30 | if (!str || !doLog) { return; } |
| 31 | try { |
| 32 | const date = new Date(); |
| 33 | str = `[${date.toISOString()}] ` + str; |
| 34 | console.log(str); |
| 35 | if (logFsPath) { |
| 36 | if (!str.endsWith('\n')) { |
| 37 | str += '\n'; |
| 38 | } |
| 39 | if (firstLog) { |
| 40 | fs.writeFileSync(logFsPath, str); |
| 41 | firstLog = false; |
| 42 | } else { |
| 43 | fs.appendFileSync(logFsPath, str); |
| 44 | } |
| 45 | } |
| 46 | } |
| 47 | catch (e) { |
| 48 | console.log(e ? e.toString() : 'unknown exception?'); |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | export class OpenOCDServerController extends EventEmitter implements GDBServerController { |
| 53 | // We wont need all of these ports but reserve them anyways |
no test coverage detected