BetterCode

This commit is contained in:
xxDeveloper
2022-02-13 22:35:21 +03:00
parent d477ac08dd
commit 9e19e2fc6d
2 changed files with 22 additions and 17 deletions

View File

@@ -1,17 +1,31 @@
import dayjs from 'dayjs';
import timezone from 'dayjs/plugin/timezone';
import utc from 'dayjs/plugin/timezone';
import dayJS from 'dayjs';
import Timezone from 'dayjs/plugin/timezone';
import UTC from 'dayjs/plugin/timezone';
enum sEvent {
TEXT_CMD,
GLOBAL_SLASH,
LOCAL_SLASH,
DM,
DM,
CRASH,
TEXT_CMD,
}
class Logger {
export default class Logger {
public log<T extends sEvent>(e : T, message: string) {
console.log(`[${'ISOSTRING (todo) '}][${sEvent[e]}] :: ${message}`);
dayJS.extend(UTC);
dayJS.extend(Timezone);
dayJS.tz.guess();
const tz = dayJS().format();
console.log(`[${`${tz}`}][${sEvent[e]}] :: ${message}`);
}
}
public tableRam() {
throw Error('unimpl');
console.table(
Object.values(process.memoryUsage())
.map(([k,v]) => { return {[k] : `${(Math.round(v) / 1024 / 1024 * 100) / 100}`} })
.reduce(((r, c) => Object.assign(r, c)), {}))
}
}

View File

@@ -2,19 +2,11 @@ import * as Files from './utilities/readFile';
import type * as Utils from './utilities/preprocessors/args';
import type {
<<<<<<< HEAD
Arg,
Context,
Visibility,
possibleOutput
} from '../Types/Handler';
=======
Arg,
Context,
Visibility,
possibleOutput
} from '../types/handler';
>>>>>>> ad86658e11a26d01e86d1a83e0bbcecef57d3001
import type {
ApplicationCommandOptionData,
@@ -28,7 +20,6 @@ import { Ok, Result, None, Some } from 'ts-results';
import { isBot, hasPrefix, fmt } from './utilities/messageHelpers';
import Logger from './logger';
/**
* @class
*/