MCPcopy Create free account
hub / github.com/Marus/cortex-debug / OpenOCDLog

Function OpenOCDLog

src/openocd.ts:29–50  ·  view source on GitHub ↗
(str: string)

Source from the content-addressed store, hash-verified

27const logFsPath = getLogPath();
28
29function 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
52export class OpenOCDServerController extends EventEmitter implements GDBServerController {
53 // We wont need all of these ports but reserve them anyways

Callers 4

serverArgumentsMethod · 0.85
rttPollMethod · 0.85
startRttMonitorMethod · 0.85
rttPollStartMethod · 0.85

Calls 2

logMethod · 0.80
toStringMethod · 0.80

Tested by

no test coverage detected