Skip to content

Commit

Permalink
made clientLog structure easier to edit via script
Browse files Browse the repository at this point in the history
  • Loading branch information
antobinary committed Aug 22, 2018
1 parent 6459b84 commit 6da18cd
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 17 deletions.
15 changes: 10 additions & 5 deletions bigbluebutton-html5/imports/startup/client/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { nameFromLevel } from '@browser-bunyan/levels';
// externalURL is the end-point that logs will be sent to
// Call the logger by doing a function call with the level name, I.e, logger.warn('Hi on warn')

const LOG_CONFIG = Meteor.settings.public.clientLog || [{ target: 'console', level: 'info' }];
const LOG_CONFIG = Meteor.settings.public.clientLog || { console: { enabled: true, level: 'info' } };
const { fullInfo } = Auth;

// Custom stream that logs to an end-point
Expand Down Expand Up @@ -66,10 +66,15 @@ function createStreamForTarget(target, options) {
}

function generateLoggerStreams(config) {
return config.map(({ target, level, ...streamOptions }) => ({
level,
stream: createStreamForTarget(target, streamOptions),
}));
let result = [];
Object.keys(config).forEach((key) => {
const logOption = config[key];
if (logOption && logOption.enabled) {
const { level, ...streamOptions } = logOption;
result = result.concat({ level, stream: createStreamForTarget(key, streamOptions) });
}
});
return result;
}

// Creates the logger with the array of streams of the chosen targets
Expand Down
11 changes: 5 additions & 6 deletions bigbluebutton-html5/private/config/settings-development.json
Original file line number Diff line number Diff line change
Expand Up @@ -343,12 +343,11 @@
]
}
},
"clientLog": [
{
"target": "server",
"level": "info"
}
]
"clientLog": {
"server": { "enabled": true, "level": "info" },
"console": { "enabled": false, "level": "debug" },
"external": { "enabled": false, "level": "info", "url": "https://LOG_HOST/html5Log", "method": "POST" }
}
},

"private": {
Expand Down
11 changes: 5 additions & 6 deletions bigbluebutton-html5/private/config/settings-production.json
Original file line number Diff line number Diff line change
Expand Up @@ -343,12 +343,11 @@
]
}
},
"clientLog": [
{
"target": "server",
"level": "info"
}
]
"clientLog": {
"server": { "enabled": true, "level": "info" },
"console": { "enabled": false, "level": "debug" },
"external": { "enabled": false, "level": "info", "url": "https://LOG_HOST/html5Log", "method": "POST" }
}
},

"private": {
Expand Down

0 comments on commit 6da18cd

Please sign in to comment.