mirror of https://github.com/Requarks/wiki.git
NGPixel
7 years ago
15 changed files with 67291 additions and 27030 deletions
Split View
Diff Options
-
3.gitignore
-
1CHANGELOG.md
-
5app/data.yml
-
47788assets/js/bundle.min.js
-
46278assets/js/configure.min.js
-
4client/configure.js
-
4client/index.js
-
11config.sample.yml
-
104fuse.js
-
64libs/logger.js
-
20libs/winston-transports/bugsnag.js
-
20libs/winston-transports/rollbar.js
-
2package.json
-
15server.js
-
2views/configure/index.pug
47788
assets/js/bundle.min.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
46278
assets/js/configure.min.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,4 @@ |
|||
'use strict' |
|||
|
|||
require('./scss/configure.scss') |
|||
require('./js/configure.js') |
@ -0,0 +1,64 @@ |
|||
'use strict' |
|||
|
|||
const winston = require('winston') |
|||
|
|||
module.exports = (isDebug) => { |
|||
if (typeof PROCNAME === 'undefined') { |
|||
const PROCNAME = 'SERVER' // eslint-disable-line no-unused-vars
|
|||
} |
|||
|
|||
// Console + File Logs
|
|||
|
|||
winston.remove(winston.transports.Console) |
|||
winston.add(winston.transports.Console, { |
|||
level: (isDebug) ? 'debug' : 'info', |
|||
prettyPrint: true, |
|||
colorize: true, |
|||
silent: false, |
|||
timestamp: true, |
|||
filters: [(level, msg, meta) => { |
|||
return '[' + PROCNAME + '] ' + msg // eslint-disable-line no-undef
|
|||
}] |
|||
}) |
|||
|
|||
// External services
|
|||
|
|||
if (appconfig.externalLogging.bugsnag) { |
|||
const bugsnagTransport = require('./winston-transports/bugsnag') |
|||
winston.add(bugsnagTransport, { |
|||
level: 'warn', |
|||
key: appconfig.externalLogging.bugsnag |
|||
}) |
|||
} |
|||
|
|||
if (appconfig.externalLogging.loggly) { |
|||
require('winston-loggly-bulk') |
|||
winston.add(winston.transports.Loggly, { |
|||
token: appconfig.externalLogging.loggly.token, |
|||
subdomain: appconfig.externalLogging.loggly.subdomain, |
|||
tags: ['wiki-js'], |
|||
level: 'warn', |
|||
json: true |
|||
}) |
|||
} |
|||
|
|||
if (appconfig.externalLogging.papertrail) { |
|||
require('winston-papertrail').Papertrail // eslint-disable-line no-unused-expressions
|
|||
winston.add(winston.transports.Papertrail, { |
|||
host: appconfig.externalLogging.papertrail.host, |
|||
port: appconfig.externalLogging.papertrail.port, |
|||
level: 'warn', |
|||
program: 'wiki.js' |
|||
}) |
|||
} |
|||
|
|||
if (appconfig.externalLogging.rollbar) { |
|||
const rollbarTransport = require('./winston-transports/rollbar') |
|||
winston.add(rollbarTransport, { |
|||
level: 'warn', |
|||
key: appconfig.externalLogging.rollbar |
|||
}) |
|||
} |
|||
|
|||
return winston |
|||
} |
@ -0,0 +1,20 @@ |
|||
'use strict' |
|||
|
|||
const util = require('util') |
|||
const winston = require('winston') |
|||
const _ = require('lodash') |
|||
|
|||
let BugsnagLogger = winston.transports.BugsnagLogger = function (options) { |
|||
this.name = 'bugsnagLogger' |
|||
this.level = options.level || 'warn' |
|||
this.bugsnag = require('bugsnag') |
|||
this.bugsnag.register(options.key) |
|||
} |
|||
util.inherits(BugsnagLogger, winston.Transport) |
|||
|
|||
BugsnagLogger.prototype.log = function (level, msg, meta, callback) { |
|||
this.bugsnag.notify(new Error(msg), _.assignIn(meta, { severity: level })) |
|||
callback(null, true) |
|||
} |
|||
|
|||
module.exports = BugsnagLogger |
@ -0,0 +1,20 @@ |
|||
'use strict' |
|||
|
|||
const util = require('util') |
|||
const winston = require('winston') |
|||
const _ = require('lodash') |
|||
|
|||
let RollbarLogger = winston.transports.RollbarLogger = function (options) { |
|||
this.name = 'rollbarLogger' |
|||
this.level = options.level || 'warn' |
|||
this.rollbar = require('rollbar') |
|||
this.rollbar.init(options.key) |
|||
} |
|||
util.inherits(RollbarLogger, winston.Transport) |
|||
|
|||
RollbarLogger.prototype.log = function (level, msg, meta, callback) { |
|||
this.rollbar.handleErrorWithPayloadData(new Error(msg), _.assignIn(meta, { level })) |
|||
callback(null, true) |
|||
} |
|||
|
|||
module.exports = RollbarLogger |
Write
Preview
Loading…
Cancel
Save