Skip to content

deleting log file while app is running #417

Answered by megahertz
tedparkdev asked this question in Q&A
Discussion options

You must be logged in to vote

I modified your code to make it self-contained. In that case, it works fine. When deleting a file while the app is running, the file is successfully re-created.

'use strict';

const { app, BrowserWindow } = require('electron');
const log = require('electron-log/main');
const path = require('path');

const pageMoveLog = log.create('pageMove');

function pageMoveLogConfig () {
  pageMoveLog.transports.file.level = process.env.LOG_LEVEL;
  pageMoveLog.transports.file.resolvePathFn = ({ libraryDefaultDir }) => {
    return path.join(libraryDefaultDir, 'page_move.log');
  }
  pageMoveLog.debug(
    `pageMove log level : ${process.env.LOG_LEVEL} pageMove log path : ` +
    pageMoveLog.transports.

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@tedparkdev
Comment options

@megahertz
Comment options

@tedparkdev
Comment options

@megahertz
Comment options

Answer selected by tedparkdev
@tedparkdev
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants