Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add log config logger option
  • Loading branch information
geek committed Jun 7, 2021
commit b16340035ce4ce00b75ebb0bc1abe6aa1a5b206f
2 changes: 1 addition & 1 deletion lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ internals.server = Validate.object({
.default(),
log: Validate.object({
level: Validate.valid('emergency', 'alert', 'critical', 'error', 'warning', 'notice', 'info', 'debug'),
logger: Validate.object().optional()
logger: Validate.object().optional().allow('std').allow('pino')
})
.allow(false)
.default(false),
Expand Down
12 changes: 11 additions & 1 deletion lib/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,21 @@ exports = module.exports = internals.Core = class {
}

_initializeLog() {

if (!this.settings.log) {
return;
}

Log.plugin.register(this.root, this.settings.log);
const { level, logger: logCfg } = this.settings.log;
let logger = new Log.Stdlogger(process.stdout, process.stderr);
if (logCfg === 'pino') {
logger = new Log.Pinologger(process.stdout);
}
else if (typeof logCfg === 'object') {
logger = logCfg;
}

Log.plugin.register(this.root, { level, logger });
}

_info() {
Expand Down
1 change: 0 additions & 1 deletion lib/server.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

const Hoek = require('@hapi/hoek');
const Log = require('@hapi/log');
const Shot = require('@hapi/shot');
const Somever = require('@hapi/somever');
const Teamwork = require('@hapi/teamwork');
Expand Down