本文整理汇总了TypeScript中common/util/paths.mainLogPath函数的典型用法代码示例。如果您正苦于以下问题:TypeScript mainLogPath函数的具体用法?TypeScript mainLogPath怎么用?TypeScript mainLogPath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mainLogPath函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: work
async work(): Promise<void> {
const logPath = mainLogPath();
const log = await sf.readFile(logPath, { encoding: "utf8" });
this.push({
log: {
log,
},
});
}
示例2: getLogStream
export function getLogStream(): NodeJS.WritableStream {
const logPath = mainLogPath();
try {
mkdirp.sync(path.dirname(logPath));
} catch (err) {
if ((err as any).code === "EEXIST") {
// good
} else {
console.log(`Could not create file sink: ${err.stack || err.message}`);
}
}
return stream({
file: logPath,
size: "2M",
keep: 5,
});
}
示例3: async
watcher.on(actions.openAppLog, async (store, action) => {
const path = mainLogPath();
logger.info(`Opening app log at ${path}`);
shell.showItemInFolder(path);
});
示例4: catch
},
level: LOG_LEVEL,
close: () => {
try {
outStream.end();
} catch (err) {
console.log(`Could not close file sink: ${err.stack || err.message}`);
}
},
});
logger.customOut = customOut;
return logger;
}
}
let defaultLogger: Logger;
if (process.type === "browser") {
const { mainLogPath } = require("common/util/paths");
defaultLogger = makeLogger({ logPath: mainLogPath() }); // log 'metal' process to file
} else {
defaultLogger = makeLogger({}); // don't log browser process to file
}
export const devNull = new Logger({
write: () => {
/* muffin */
},
});
export default defaultLogger;