Improve logging configuration structure

This commit is contained in:
Alice Gaudon 2020-09-25 22:19:13 +02:00
parent b736f5f6cb
commit 8210642684
4 changed files with 16 additions and 10 deletions

View File

@ -1,10 +1,13 @@
module.exports = { export default {
app: { app: {
name: 'Example App', name: 'Example App',
contact_email: 'contact@example.net' contact_email: 'contact@example.net'
}, },
log_level: "DEV", log: {
db_log_level: "ERROR", level: "DEBUG",
verbose: true,
db_level: "ERROR",
},
base_url: "http://localhost:4899", base_url: "http://localhost:4899",
public_websocket_url: "ws://localhost:4899", public_websocket_url: "ws://localhost:4899",
listen_addr: '127.0.0.1', listen_addr: '127.0.0.1',

View File

@ -1,6 +1,9 @@
module.exports = { export default {
log_level: "DEBUG", log: {
db_log_level: "ERROR", level: "DEV",
verbose: false,
db_level: "ERROR",
},
base_url: "https://watch-my.stream", base_url: "https://watch-my.stream",
public_websocket_url: "wss://watch-my.stream", public_websocket_url: "wss://watch-my.stream",
session: { session: {

View File

@ -1,4 +1,4 @@
module.exports = { export default {
mysql: { mysql: {
host: "localhost", host: "localhost",
user: "root", user: "root",

View File

@ -4,9 +4,9 @@ import Log from "./models/Log";
import {bufferToUUID} from "./Utils"; import {bufferToUUID} from "./Utils";
export default class Logger { export default class Logger {
private static logLevel: LogLevelKeys = <LogLevelKeys>config.get<string>('log_level'); private static logLevel: LogLevelKeys = <LogLevelKeys>config.get<string>('log.level');
private static dbLogLevel: LogLevelKeys = <LogLevelKeys>config.get<string>('db_log_level'); private static dbLogLevel: LogLevelKeys = <LogLevelKeys>config.get<string>('log.db_level');
private static verboseMode: boolean = false; private static verboseMode: boolean = config.get<boolean>('log.verbose');
public static verbose() { public static verbose() {
this.verboseMode = true; this.verboseMode = true;