mirror of
https://github.com/sern-handler/handler
synced 2026-06-06 01:16:55 +00:00
some comments and comment refactoring
This commit is contained in:
@@ -11,33 +11,27 @@ enum sEvent {
|
||||
}
|
||||
|
||||
export default class Logger {
|
||||
|
||||
public log<T extends sEvent>(e : T, message: string) {
|
||||
dayJS.extend(UTC);
|
||||
dayJS.extend(Timezone);
|
||||
dayJS.tz.guess();
|
||||
|
||||
// add colored logging?
|
||||
const tz = dayJS().format();
|
||||
console.log(`[${`${tz}`}][${sEvent[e]}] :: ${message}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* ┌──────────────┬─────────┐
|
||||
* │ (index) │ Values │
|
||||
* ├──────────────┼─────────┤
|
||||
* │ rss │ '50.26' │
|
||||
* │ heapTotal │ '29.15' │
|
||||
* │ heapUsed │ '12.62' │
|
||||
* │ external │ '0.84' │
|
||||
* │ arrayBuffers │ '0.10' │
|
||||
* └──────────────┴─────────┘
|
||||
* This method will print out memory usage. Optional at startup.
|
||||
*/
|
||||
* Utilizes console.table() to print out memory usage of current process.
|
||||
* Optional at startup.
|
||||
*
|
||||
*/
|
||||
|
||||
public tableRam() {
|
||||
console.table(
|
||||
Object.entries(process.memoryUsage())
|
||||
.map(([k, v]: [string, number]) => {
|
||||
return { [k]: ((Math.round(v) / 1024 / 1024 * 100) / 100).toFixed(2) };
|
||||
return { [k]: `${((Math.round(v) / 1024 / 1024 * 100) / 100).toFixed(2)} MBs` };
|
||||
})
|
||||
.reduce(((r, c) => Object.assign(r, c)), {})
|
||||
);
|
||||
|
||||
@@ -47,7 +47,7 @@ export class Handler {
|
||||
Files.buildData(this)
|
||||
.then(data => this.registerModules(data))
|
||||
if (wrapper.init !== undefined) wrapper.init(this);
|
||||
new Logger().tableRam();
|
||||
new Logger().tableRam()
|
||||
})
|
||||
|
||||
.on('messageCreate', async (message: Message) => {
|
||||
@@ -256,7 +256,7 @@ export interface Wrapper {
|
||||
}
|
||||
|
||||
/**
|
||||
* An object to be passed into Sern.Handler constructor.
|
||||
* An object that gets imported and acts as a command.
|
||||
* @typedef {object} Module<T=string>
|
||||
* @property {string} desc
|
||||
* @property {Visibility} visibility
|
||||
|
||||
@@ -11,7 +11,6 @@ import type {
|
||||
import type * as Sern from '../handler/sern';
|
||||
|
||||
export type Visibility = 'private' | 'public';
|
||||
|
||||
// Anything that can be sent in a `<TextChannel>#send` or `<CommandInteraction>#reply`
|
||||
export type possibleOutput<T = string> = T | MessagePayload & MessageOptions;
|
||||
export type Nullable<T> = T | null;
|
||||
|
||||
Reference in New Issue
Block a user