instantiate logger sooner

This commit is contained in:
Erik 2023-02-08 00:03:50 +02:00
parent dd00b85dfc
commit 9217103bae
Signed by: Navy.gif
GPG Key ID: 2532FBBB61C65A68

View File

@ -53,6 +53,8 @@ class Server extends EventEmitter {
if (!httpOpts?.port) if (!httpOpts?.port)
return Util.fatal(new Error(`Missing http.port in server options`)); return Util.fatal(new Error(`Missing http.port in server options`));
this.logger = new LoggerClient({ ...options.logger, name: this.constructor.name });
// Port number is automatically incremented based on shard # // Port number is automatically incremented based on shard #
this.port = httpOpts.port + this._shardId; this.port = httpOpts.port + this._shardId;
// Primarily used by the OAuth methods for the callback url // Primarily used by the OAuth methods for the callback url
@ -78,7 +80,6 @@ class Server extends EventEmitter {
// Takes care of loading endpoints, all endpoints need to inherit the endpoint class in /interfaces // Takes care of loading endpoints, all endpoints need to inherit the endpoint class in /interfaces
this.registry = new Registry(this, { path: path.join(__dirname, 'endpoints') }); this.registry = new Registry(this, { path: path.join(__dirname, 'endpoints') });
this.logger = new LoggerClient({ ...options.logger, name: this.constructor.name });
// Mariadb isn't strictly necessary here for anything, it's just here pre-emptively // Mariadb isn't strictly necessary here for anything, it's just here pre-emptively
this.mariadb = new MariaDB(this, { options: databases.mariadb, MARIA_HOST, MARIA_USER, MARIA_PORT, MARIA_PASS, MARIA_DB }); this.mariadb = new MariaDB(this, { options: databases.mariadb, MARIA_HOST, MARIA_USER, MARIA_PORT, MARIA_PASS, MARIA_DB });