some comments and comment refactoring

This commit is contained in:
jacoobes
2022-02-13 14:16:10 -06:00
parent c3d29f7016
commit ce22f854a1
3 changed files with 9 additions and 16 deletions

View File

@@ -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)), {})
);

View File

@@ -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

View File

@@ -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;