mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-09-11 23:24:32 +08:00
[local-sync] only enable logging in dev mode of N1
This commit is contained in:
parent
9752eea9f7
commit
2ba326dfc6
2 changed files with 9 additions and 1 deletions
|
@ -176,7 +176,6 @@ class SyncWorker {
|
|||
return;
|
||||
}
|
||||
|
||||
console.log(this._account)
|
||||
this._logger.info({reason}, `SyncWorker: Account sync started`)
|
||||
|
||||
try {
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
const _ = require('underscore')
|
||||
|
||||
let ENABLE_LOGGING = true;
|
||||
|
||||
function Logger(boundArgs = {}) {
|
||||
if (NylasEnv && !NylasEnv.inDevMode()) {
|
||||
ENABLE_LOGGING = false
|
||||
}
|
||||
|
||||
if (!_.isObject(boundArgs)) {
|
||||
throw new Error('Logger: Bound arguments must be an object')
|
||||
}
|
||||
|
@ -8,6 +14,9 @@ function Logger(boundArgs = {}) {
|
|||
const loggerFns = ['log', 'info', 'warn', 'error']
|
||||
loggerFns.forEach((logFn) => {
|
||||
logger[logFn] = (first, ...args) => {
|
||||
if (!ENABLE_LOGGING && logFn !== "error") {
|
||||
return () => {}
|
||||
}
|
||||
if (first instanceof Error || !_.isObject(first)) {
|
||||
if (_.isEmpty(boundArgs)) {
|
||||
return console[logFn](first, ...args)
|
||||
|
|
Loading…
Add table
Reference in a new issue