address comments
This commit is contained in:
parent
acc31427dd
commit
7762584fb1
1 changed files with 10 additions and 13 deletions
|
@ -13,18 +13,15 @@ require('@electron/remote/main').initialize()
|
||||||
const store = new Store()
|
const store = new Store()
|
||||||
let tray: Tray | null = null
|
let tray: Tray | null = null
|
||||||
|
|
||||||
const logFile = new winston.transports.DailyRotateFile({
|
const logFile = new winston.transports.File({
|
||||||
filename: path.join(app.getPath('home'), '.ollama', 'logs', 'server-%DATE%.log'),
|
filename: path.join(app.getPath('home'), '.ollama', 'logs', 'server.log'),
|
||||||
datePattern: 'YYYY-MM-DD-HH',
|
maxsize: 1024 * 1024 * 20,
|
||||||
zippedArchive: true,
|
maxFiles: 5,
|
||||||
maxSize: '20m',
|
|
||||||
maxFiles: '7d',
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const logger = winston.createLogger({
|
const logger = winston.createLogger({
|
||||||
transports: [logFile],
|
transports: [logFile],
|
||||||
format: winston.format.combine(
|
format: winston.format.combine(
|
||||||
winston.format.colorize(),
|
|
||||||
winston.format.timestamp(),
|
winston.format.timestamp(),
|
||||||
winston.format.printf(info => `${info.timestamp} ${info.level}: ${info.message}`)
|
winston.format.printf(info => `${info.timestamp} ${info.level}: ${info.message}`)
|
||||||
)
|
)
|
||||||
|
@ -64,10 +61,10 @@ function server() {
|
||||||
|
|
||||||
const proc = spawn(binary, ['serve'])
|
const proc = spawn(binary, ['serve'])
|
||||||
proc.stdout.on('data', data => {
|
proc.stdout.on('data', data => {
|
||||||
logger.info(`[server] ${data.toString()}`)
|
logger.info(`server: ${data.toString()}`)
|
||||||
})
|
})
|
||||||
proc.stderr.on('data', data => {
|
proc.stderr.on('data', data => {
|
||||||
logger.error(`[server] ${data.toString()}`)
|
logger.error(`server: ${data.toString()}`)
|
||||||
})
|
})
|
||||||
|
|
||||||
proc.on('exit', () => {
|
proc.on('exit', () => {
|
||||||
|
@ -107,12 +104,12 @@ function installCLI() {
|
||||||
`
|
`
|
||||||
exec(`osascript -e '${command}'`, (error: Error | null, stdout: string, stderr: string) => {
|
exec(`osascript -e '${command}'`, (error: Error | null, stdout: string, stderr: string) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
logger.error(`[CLI] Failed to install CLI - ${error.message}`)
|
logger.error(`CLI: Failed to install CLI - ${error.message}`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info(`[CLI] ${stdout}}`)
|
logger.info(`CLI: ${stdout}}`)
|
||||||
logger.error(`[CLI] ${stderr}`)
|
logger.error(`CLI: ${stderr}`)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -206,7 +203,7 @@ if (app.isPackaged) {
|
||||||
}
|
}
|
||||||
|
|
||||||
autoUpdater.on('error', e => {
|
autoUpdater.on('error', e => {
|
||||||
logger.error(`[auto updater] update check failed - ${e.message}`)
|
logger.error(`auto updater: update check failed - ${e.message}`)
|
||||||
})
|
})
|
||||||
|
|
||||||
autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => {
|
autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => {
|
||||||
|
|
Loading…
Reference in a new issue