@fallencodes/seyfert-utils 1.1.7 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ export declare function customizeLogger(): void;
2
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAIA,wBAAgB,eAAe,SAkB9B"}
@@ -0,0 +1,34 @@
1
+ import dayjs from 'dayjs';
2
+ import { Logger } from 'seyfert';
3
+ import { red, LogLevels, cyan, dim, yellow, bgRed, gray, bold } from 'seyfert/lib/common/index.js';
4
+ export function customizeLogger() {
5
+ Logger.customize((_, level, args) => {
6
+ let color = red;
7
+ switch (level) {
8
+ case LogLevels.Info:
9
+ color = cyan;
10
+ break;
11
+ case LogLevels.Debug:
12
+ color = dim;
13
+ break;
14
+ case LogLevels.Warn:
15
+ color = yellow;
16
+ break;
17
+ case LogLevels.Fatal:
18
+ color = bgRed;
19
+ break;
20
+ }
21
+ ;
22
+ return [
23
+ brackets(gray(dayjs().format('YYYY-MM-DD HH:mm:ss'))),
24
+ brackets(dim(`RSS: ${(process.memoryUsage().rss / 1024 / 1024).toFixed(2)} MiB`)),
25
+ brackets(color(Logger.prefixes.get(level) ?? 'UNKNOWN')),
26
+ ...args
27
+ ];
28
+ });
29
+ }
30
+ ;
31
+ function brackets(content) {
32
+ return `${bold(gray('['))}${content}${bold(gray(']'))}`;
33
+ }
34
+ ;
@@ -8,5 +8,6 @@ type NameType = 'display' | 'display-s' | 'display-username' | 'display-username
8
8
  export declare function name(user: User | GuildMember, type?: NameType): string;
9
9
  export declare function reviver(_key: string, value: any): any;
10
10
  export declare function replacer(_key: string, value: any): any;
11
+ export declare function numberToHex(color: number): string;
11
12
  export {};
12
13
  //# sourceMappingURL=utilities.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utilities.d.ts","sourceRoot":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gB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,GAAE,MAAY,GAAG,MAAM,CAI9E;AAED,KAAK,QAAQ,GACX,SAAS,GACT,WAAW,GACX,kBAAkB,GAClB,oBAAoB,GACpB,aAAa,GACb,eAAe,CAAA;AAGjB,wBAAgB,IAAI,CAAC,IAAI,EAAE,IAAI,GAAG,WAAW,EAAE,IAAI,GAAE,QAAoB,GAAG,MAAM,CAWjF;AAGD,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,OAG/C;AAGD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,OAIhD;AAGD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,UAExC"}
@@ -64,3 +64,8 @@ export function replacer(_key, value) {
64
64
  return value;
65
65
  }
66
66
  ;
67
+ /* Converts a number colour to a padded hex code. */
68
+ export function numberToHex(color) {
69
+ return `#${color.toString(16).toUpperCase().padEnd(6, '0')}`;
70
+ }
71
+ ;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fallencodes/seyfert-utils",
3
3
  "type": "module",
4
- "version": "1.1.7",
4
+ "version": "1.2.0",
5
5
  "license": "MIT",
6
6
  "description": "A collection of various utility/helper code I use in my Seyfert projects.",
7
7
  "main": "build/index.js",
@@ -27,11 +27,13 @@
27
27
  ],
28
28
  "exports": {
29
29
  ".": "./build/index.js",
30
+ "./logger": "./build/logger.js",
30
31
  "./components/*": "./build/components/*.js",
31
32
  "./handleCommand": "./build/handleCommand.js"
32
33
  },
33
34
  "dependencies": {
34
35
  "@sapphire/snowflake": "^3.5.5",
36
+ "dayjs": "^1.11.19",
35
37
  "multibyte": "^1.0.5",
36
38
  "nanoid": "^5.1.6",
37
39
  "seyfert": "^4.0.0"