mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
feat(server/debug): Added initial implementation of new Logger (#84)
- Logs out to a file w/ relevant meta data - Provides better readability for end user This should help provide better troubleshooting for both development and end users. This also fixes any previous catches that were attempting to print stack traces, causing the [object Object] message to appear. Co-authored-by: Christopher Gjelten <[email protected]>
This commit is contained in:
1 parent
a5491302b6
commit
211576e237
18 files changed
+363
-114
No files matched your search
@@ -8,6 +8,9 @@ import {
|
||||
} from '../../phone/src/common/typings/messages';
|
||||
import { pool, withTransaction } from './db';
|
||||
import { getSource, useIdentifier } from './functions';
|
||||
import { mainLogger } from './sv_logger';
|
||||
|
||||
const messageLogger = mainLogger.child({ module: 'messages' });
|
||||
|
||||
/**
|
||||
* Used for the raw npwd_messages_groups row responses
|
||||
@@ -383,6 +386,7 @@ onNet(events.MESSAGES_FETCH_MESSAGE_GROUPS, async () => {
|
||||
);
|
||||
} catch (e) {
|
||||
emitNet(events.MESSAGES_FETCH_MESSAGE_GROUPS_FAILED, getSource());
|
||||
messageLogger.error(`Failed to fetch messages groups, ${e.message}`);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -412,6 +416,7 @@ onNet(
|
||||
}
|
||||
} catch (e) {
|
||||
emitNet(events.MESSAGES_CREATE_MESSAGE_GROUP_FAILED, getSource());
|
||||
messageLogger.error(`Failed to create message group, ${e.message}`);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -423,6 +428,7 @@ onNet(events.MESSAGES_FETCH_MESSAGES, async (groupId: string) => {
|
||||
emitNet(events.MESSAGES_FETCH_MESSAGES_SUCCESS, getSource(), messages);
|
||||
} catch (e) {
|
||||
emitNet(events.MESSAGES_FETCH_MESSAGES_FAILED, getSource());
|
||||
messageLogger.error(`Failed to fetch messages, ${e.message}`);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -435,6 +441,7 @@ onNet(
|
||||
emitNet(events.MESSAGES_SEND_MESSAGE_SUCCESS, getSource(), groupId);
|
||||
} catch (e) {
|
||||
emitNet(events.MESSAGES_SEND_MESSAGE_FAILED, getSource());
|
||||
messageLogger.error(`Failed to send message, ${e.message}`);
|
||||
}
|
||||
}
|
||||
);
|
||||
Reference in new issue
Block a user