socket io stuff entered
This commit is contained in:
@@ -18,6 +18,7 @@ interface Data<T = unknown[]> {
|
||||
| "settings";
|
||||
level: "info" | "error" | "debug" | "fatal";
|
||||
message: string;
|
||||
room?: string;
|
||||
data?: T;
|
||||
notify?: boolean;
|
||||
}
|
||||
@@ -38,20 +39,21 @@ interface Data<T = unknown[]> {
|
||||
*/
|
||||
export const returnFunc = (data: Data) => {
|
||||
const notify = data.notify ? data.notify : false;
|
||||
const room = data.room ?? data.room;
|
||||
const log = createLogger({ module: data.module, subModule: data.subModule });
|
||||
// handle the logging part
|
||||
switch (data.level) {
|
||||
case "info":
|
||||
log.info({ notify: notify }, data.message);
|
||||
log.info({ notify: notify, room }, data.message);
|
||||
break;
|
||||
case "error":
|
||||
log.error({ notify: notify, error: data.data }, data.message);
|
||||
log.error({ notify: notify, error: data.data, room }, data.message);
|
||||
break;
|
||||
case "debug":
|
||||
log.debug({ notify: notify }, data.message);
|
||||
log.debug({ notify: notify, room }, data.message);
|
||||
break;
|
||||
case "fatal":
|
||||
log.fatal({ notify: notify }, data.message);
|
||||
log.fatal({ notify: notify, room }, data.message);
|
||||
}
|
||||
|
||||
// api section to return
|
||||
|
||||
Reference in New Issue
Block a user