fix: log is not generated after clear log from setting (#2732)
Signed-off-by: James <james@jan.ai> Co-authored-by: James <james@jan.ai>
This commit is contained in:
parent
49401bd8eb
commit
889d374fad
@ -32,7 +32,6 @@ export enum AppRoute {
|
|||||||
startServer = 'startServer',
|
startServer = 'startServer',
|
||||||
stopServer = 'stopServer',
|
stopServer = 'stopServer',
|
||||||
log = 'log',
|
log = 'log',
|
||||||
logServer = 'logServer',
|
|
||||||
systemInformation = 'systemInformation',
|
systemInformation = 'systemInformation',
|
||||||
showToast = 'showToast',
|
showToast = 'showToast',
|
||||||
}
|
}
|
||||||
|
|||||||
@ -126,6 +126,10 @@ export class FileLogger extends Logger {
|
|||||||
|
|
||||||
const writeLog = (message: string, logPath: string) => {
|
const writeLog = (message: string, logPath: string) => {
|
||||||
if (!fs.existsSync(logPath)) {
|
if (!fs.existsSync(logPath)) {
|
||||||
|
const logDirectory = path.join(getJanDataFolderPath(), 'logs')
|
||||||
|
if (!fs.existsSync(logDirectory)) {
|
||||||
|
fs.mkdirSync(logDirectory)
|
||||||
|
}
|
||||||
fs.writeFileSync(logPath, message)
|
fs.writeFileSync(logPath, message)
|
||||||
} else {
|
} else {
|
||||||
const logFile = fs.createWriteStream(logPath, {
|
const logFile = fs.createWriteStream(logPath, {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user