mac os
function outputLog333(msg) {
// 获取应用的用户数据目录
const logDirectory = app.getPath('userData')
// 拼接日志文件路径
const outFilePath = path.join(logDirectory, 'out.txt')
// 追加写入日志
fs.appendFile(outFilePath, `${msg} \n`, 'utf8', (err) => {
if (err) {
console.error('Error appending to file:', err)
} else {
// console.log('Data appended successfully')
}
})
}
日志打印后去 ~/Library/Application Support 找