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: {
name: 'Example App',
contact_email: 'contact@example.net'
},
log_level: "DEV",
db_log_level: "ERROR",
log: {
level: "DEBUG",
verbose: true,
db_level: "ERROR",
},
base_url: "http://localhost:4899",
public_websocket_url: "ws://localhost:4899",
listen_addr: '127.0.0.1',

View File

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

View File

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

View File

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