Compare commits

..

No commits in common. "8a03f4e171e2c81c7b906e6e89df0deb9add206b" and "1a45c35090b7fa4f669ec7bd983a0c8bb2e94aa0" have entirely different histories.

3 changed files with 10 additions and 16 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@navy.gif/wrappers", "name": "@navy.gif/wrappers",
"version": "1.6.7", "version": "1.6.6",
"description": "Various wrapper classes I use in my projects", "description": "Various wrapper classes I use in my projects",
"repository": "https://git.corgi.wtf/Navy.gif/wrappers.git", "repository": "https://git.corgi.wtf/Navy.gif/wrappers.git",
"author": "Navy.gif", "author": "Navy.gif",

View File

@ -277,7 +277,7 @@ class MariaDB
{ {
const oldStatus = node.status; const oldStatus = node.status;
node.status = 'disconnected'; node.status = 'disconnected';
this.#logger.status(`Cluster node ${node.name} changed status from ${oldStatus} to ${node.status}`, { broadcast: true }); this.#logger.status(`Cluster node ${node.name} changed status from ${oldStatus} to ${node.status}`);
} }
}); });
else if (update.status === 'synced') else if (update.status === 'synced')
@ -289,7 +289,7 @@ class MariaDB
{ {
const oldStatus = node.status; const oldStatus = node.status;
node.status = 'synced'; node.status = 'synced';
this.#logger.status(`Cluster node ${node.name} changed status from ${oldStatus} to ${node.status}`, { broadcast: true }); this.#logger.status(`Cluster node ${node.name} changed status from ${oldStatus} to ${node.status}`);
} }
}); });
} }
@ -299,7 +299,6 @@ class MariaDB
const index = parseInt(update.index); const index = parseInt(update.index);
if (index === -1) if (index === -1)
return this.#logger.warn('Received -1 index, member does not recognise itself'); return this.#logger.warn('Received -1 index, member does not recognise itself');
const member = members[index]; const member = members[index];
const [ id,, host ] = member.split('/'); const [ id,, host ] = member.split('/');
let node = this.#nodes.find(n => n.uuid === id); let node = this.#nodes.find(n => n.uuid === id);
@ -308,7 +307,7 @@ class MariaDB
const [ ip ] = host.split(':'); const [ ip ] = host.split(':');
node = this.#nodes.find(n => n.host === ip); node = this.#nodes.find(n => n.host === ip);
if (!node) if (!node)
return this.#logger.warn('Received status update for node that is not present in config', { broadcast: true }); return this.#logger.warn('Received status update for node that is not present in config');
node.uuid = id; node.uuid = id;
} }
@ -316,7 +315,7 @@ class MariaDB
{ {
const oldStatus = node.status; const oldStatus = node.status;
node.status = update.status; node.status = update.status;
this.#logger.status(`Cluster node ${node.name} changed status from ${oldStatus} to ${node.status}`, { broadcast: true }); this.#logger.status(`Cluster node ${node.name} changed status from ${oldStatus} to ${node.status}`);
} }
} }

View File

@ -5,15 +5,10 @@ export type LoggerClientOptions = {
logLevelMapping: {[key: string]: number} logLevelMapping: {[key: string]: number}
} }
type WriteOptions = {
subheader?: string,
broadcast?: boolean
}
export interface ILogger { export interface ILogger {
info(str: string | object, opts?: WriteOptions): void info(str: string | object): void
status(str: string | object, opts?: WriteOptions): void status(str: string | object): void
debug(str: string | object, opts?: WriteOptions): void debug(str: string | object): void
warn(str: string | object, opts?: WriteOptions): void warn(str: string | object): void
error(str: string | object, opts?: WriteOptions): void error(str: string | object): void
} }