How to use the electron-log.transports.file function in electron-log

To help you get started, we’ve selected a few electron-log examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github symphonyoss / SymphonyElectron / src / common / logger.ts View on Github external
fs.mkdirSync(customLogsFolder, { recursive: true });
            }
            app.setPath('logs', customLogsFolder);
        }

        if (isLinux) {
            this.logPath = app.getPath('appData');
        } else {
            this.logPath = app.getPath('logs');
        }

        if (app.isPackaged) {
            transports.file.file = path.join(this.logPath, `app_${Date.now()}.log`);
            transports.file.level = 'debug';
            transports.file.format = '{y}-{m}-{d} {h}:{i}:{s}:{ms} {z} | {level} | {text}';
            transports.file.appName = 'Symphony';
        }

        const logLevel = getCommandLineArgs(process.argv, '--logLevel=', false);
        if (logLevel) {
            const level = logLevel.split('=')[1];
            if (level) {
                this.desiredLogLevel = level as LogLevel;
            }
        }

        if (getCommandLineArgs(process.argv, '--enableConsoleLogging', false)) {
            this.showInConsole = true;
        }

        // cleans up old logs if there are any
        if (app.isPackaged) {
github symphonyoss / SymphonyElectron / src / common / logger.ts View on Github external
if (!fs.existsSync(customLogsFolder)) {
                fs.mkdirSync(customLogsFolder, { recursive: true });
            }
            app.setPath('logs', customLogsFolder);
        }

        if (isLinux) {
            this.logPath = app.getPath('appData');
        } else {
            this.logPath = app.getPath('logs');
        }

        if (app.isPackaged) {
            transports.file.file = path.join(this.logPath, `app_${Date.now()}.log`);
            transports.file.level = 'debug';
            transports.file.format = '{y}-{m}-{d} {h}:{i}:{s}:{ms} {z} | {level} | {text}';
            transports.file.appName = 'Symphony';
        }

        const logLevel = getCommandLineArgs(process.argv, '--logLevel=', false);
        if (logLevel) {
            const level = logLevel.split('=')[1];
            if (level) {
                this.desiredLogLevel = level as LogLevel;
            }
        }

        if (getCommandLineArgs(process.argv, '--enableConsoleLogging', false)) {
            this.showInConsole = true;
        }

        // cleans up old logs if there are any
github symphonyoss / SymphonyElectron / src / common / logger.ts View on Github external
const customLogsFolder = customLogPathArg && customLogPathArg.substring(customLogPathArg.indexOf('=') + 1);
        if (customLogsFolder) {
            if (!fs.existsSync(customLogsFolder)) {
                fs.mkdirSync(customLogsFolder, { recursive: true });
            }
            app.setPath('logs', customLogsFolder);
        }

        if (isLinux) {
            this.logPath = app.getPath('appData');
        } else {
            this.logPath = app.getPath('logs');
        }

        if (app.isPackaged) {
            transports.file.file = path.join(this.logPath, `app_${Date.now()}.log`);
            transports.file.level = 'debug';
            transports.file.format = '{y}-{m}-{d} {h}:{i}:{s}:{ms} {z} | {level} | {text}';
            transports.file.appName = 'Symphony';
        }

        const logLevel = getCommandLineArgs(process.argv, '--logLevel=', false);
        if (logLevel) {
            const level = logLevel.split('=')[1];
            if (level) {
                this.desiredLogLevel = level as LogLevel;
            }
        }

        if (getCommandLineArgs(process.argv, '--enableConsoleLogging', false)) {
            this.showInConsole = true;
        }
github symphonyoss / SymphonyElectron / src / common / logger.ts View on Github external
if (customLogsFolder) {
            if (!fs.existsSync(customLogsFolder)) {
                fs.mkdirSync(customLogsFolder, { recursive: true });
            }
            app.setPath('logs', customLogsFolder);
        }

        if (isLinux) {
            this.logPath = app.getPath('appData');
        } else {
            this.logPath = app.getPath('logs');
        }

        if (app.isPackaged) {
            transports.file.file = path.join(this.logPath, `app_${Date.now()}.log`);
            transports.file.level = 'debug';
            transports.file.format = '{y}-{m}-{d} {h}:{i}:{s}:{ms} {z} | {level} | {text}';
            transports.file.appName = 'Symphony';
        }

        const logLevel = getCommandLineArgs(process.argv, '--logLevel=', false);
        if (logLevel) {
            const level = logLevel.split('=')[1];
            if (level) {
                this.desiredLogLevel = level as LogLevel;
            }
        }

        if (getCommandLineArgs(process.argv, '--enableConsoleLogging', false)) {
            this.showInConsole = true;
        }