Compare commits
2 Commits
1a45c35090
...
8a03f4e171
Author | SHA1 | Date | |
---|---|---|---|
8a03f4e171 | |||
9fce8c72ff |
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@navy.gif/wrappers",
|
"name": "@navy.gif/wrappers",
|
||||||
"version": "1.6.6",
|
"version": "1.6.7",
|
||||||
"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",
|
||||||
|
@ -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}`);
|
this.#logger.status(`Cluster node ${node.name} changed status from ${oldStatus} to ${node.status}`, { broadcast: true });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
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}`);
|
this.#logger.status(`Cluster node ${node.name} changed status from ${oldStatus} to ${node.status}`, { broadcast: true });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -299,6 +299,7 @@ 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);
|
||||||
@ -307,7 +308,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');
|
return this.#logger.warn('Received status update for node that is not present in config', { broadcast: true });
|
||||||
node.uuid = id;
|
node.uuid = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,7 +316,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}`);
|
this.#logger.status(`Cluster node ${node.name} changed status from ${oldStatus} to ${node.status}`, { broadcast: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,10 +5,15 @@ export type LoggerClientOptions = {
|
|||||||
logLevelMapping: {[key: string]: number}
|
logLevelMapping: {[key: string]: number}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ILogger {
|
type WriteOptions = {
|
||||||
info(str: string | object): void
|
subheader?: string,
|
||||||
status(str: string | object): void
|
broadcast?: boolean
|
||||||
debug(str: string | object): void
|
}
|
||||||
warn(str: string | object): void
|
|
||||||
error(str: string | object): void
|
export interface ILogger {
|
||||||
|
info(str: string | object, opts?: WriteOptions): void
|
||||||
|
status(str: string | object, opts?: WriteOptions): void
|
||||||
|
debug(str: string | object, opts?: WriteOptions): void
|
||||||
|
warn(str: string | object, opts?: WriteOptions): void
|
||||||
|
error(str: string | object, opts?: WriteOptions): void
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user