-
This might be something very basic, but I am desperate - I try to keep several logs by overriding the archiveLog callback like this: import log from "electron-log"
import path from "path"
import fs from "fs"
import moment from "moment"
log.transports.file.archiveLog = (file: string) => {
const fileStr = file.toString()
const fileInfo = path.parse(fileStr)
try {
fs.renameSync(fileStr, path.join(fileInfo.dir, fileInfo.name + "." + moment().format('YYYYMMDDHHmmss') + fileInfo.ext))
} catch (e) {
console.warn("Could not rotate log", e)
}
} but it does not help. Something changes, because the file is not rotated at all and new messages are added to it only, but it is not what I need. I also tried debug it like this, but I get no message in the console log.transports.file.archiveLog = (file: string) => {
console.log('LOGGING')
} |
Beta Was this translation helpful? Give feedback.
Answered by
megahertz
Jan 4, 2022
Replies: 1 comment 1 reply
-
Firstly, you need to make sure that you code is executed. Try to set |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
gorn
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Firstly, you need to make sure that you code is executed. Try to set
maxSize
to 1 for debugging your custom handler.