🔊 oo-connector: output JSON logs in production

This commit is contained in:
Eric Doughty-Papassideris
2024-11-22 16:54:51 +01:00
parent c1856ca634
commit 33e88bb927
2 changed files with 4 additions and 0 deletions
@@ -16,6 +16,8 @@ export const {
OOCONNECTOR_HEALTH_SECRET, OOCONNECTOR_HEALTH_SECRET,
} = process.env; } = process.env;
export const isProductionEnv = (NODE_ENV ?? '').toLocaleLowerCase().trim() === 'production';
const secs = 1000, const secs = 1000,
mins = 60 * secs; mins = 60 * secs;
@@ -1,5 +1,7 @@
import { Logger } from 'tslog'; import { Logger } from 'tslog';
import { isProductionEnv } from '../config';
export default new Logger({ export default new Logger({
name: 'twake-onlyoffice-plugin', name: 'twake-onlyoffice-plugin',
type: isProductionEnv ? 'json' : 'pretty',
}); });