mynth-logger 2.0.10 → 2.0.11
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.
- package/dist/src/discord.d.ts +13 -0
- package/dist/src/discord.js +33 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/reporters/discord.d.ts +13 -0
- package/dist/src/reporters/discord.js +1 -0
- package/package.json +1 -1
- package/src/discord.ts +46 -0
- package/src/index.ts +1 -0
- package/src/reporters/discord.ts +2 -0
- package/src/index.d.ts +0 -3
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare enum color {
|
|
2
|
+
green = "2404635",
|
|
3
|
+
red = "11606811",
|
|
4
|
+
yellow = "11644443"
|
|
5
|
+
}
|
|
6
|
+
declare const discord: {
|
|
7
|
+
configure: (webhookUrl: string) => void;
|
|
8
|
+
debug: (title: string, message: string, color?: color | string) => void;
|
|
9
|
+
error: (title: string, message: string, color?: color | string) => void;
|
|
10
|
+
info: (title: string, message: string, color?: color | string) => void;
|
|
11
|
+
log: (title: string, message: string, color?: color | string) => void;
|
|
12
|
+
};
|
|
13
|
+
export { color, discord };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type } from "arktype";
|
|
2
|
+
var color;
|
|
3
|
+
(function (color) {
|
|
4
|
+
color["green"] = "2404635";
|
|
5
|
+
color["red"] = "11606811";
|
|
6
|
+
color["yellow"] = "11644443";
|
|
7
|
+
})(color || (color = {}));
|
|
8
|
+
const green = color.green;
|
|
9
|
+
const red = color.red;
|
|
10
|
+
const yellow = color.yellow;
|
|
11
|
+
const log = (level, color, title, message) => {
|
|
12
|
+
const settings = {
|
|
13
|
+
color,
|
|
14
|
+
discord: true,
|
|
15
|
+
title,
|
|
16
|
+
};
|
|
17
|
+
console[level](message, settings);
|
|
18
|
+
};
|
|
19
|
+
const discord = {
|
|
20
|
+
configure: (webhookUrl) => {
|
|
21
|
+
type("string.url").assert(webhookUrl);
|
|
22
|
+
const settings = {
|
|
23
|
+
discord: true,
|
|
24
|
+
setWebhookUrl: webhookUrl,
|
|
25
|
+
};
|
|
26
|
+
console.debug(settings);
|
|
27
|
+
},
|
|
28
|
+
debug: (title, message, color = yellow) => log("debug", color, title, message),
|
|
29
|
+
error: (title, message, color = red) => log("error", color, title, message),
|
|
30
|
+
info: (title, message, color = green) => log("info", color, title, message),
|
|
31
|
+
log: (title, message, color = green) => log("log", color, title, message),
|
|
32
|
+
};
|
|
33
|
+
export { color, discord };
|
package/dist/src/index.d.ts
CHANGED
package/dist/src/index.js
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import { LogObject } from "consola";
|
|
2
|
+
declare const Discord: import("arktype/internal/methods/object.ts").ObjectType<{
|
|
3
|
+
discord: true;
|
|
4
|
+
color: string;
|
|
5
|
+
title: string;
|
|
6
|
+
webhookUrl?: string | undefined;
|
|
7
|
+
}, {}>;
|
|
8
|
+
declare const ConfigureDiscord: import("arktype/internal/methods/object.ts").ObjectType<{
|
|
9
|
+
discord: true;
|
|
10
|
+
setWebhookUrl: string;
|
|
11
|
+
}, {}>;
|
|
12
|
+
type Discord = typeof Discord.infer;
|
|
13
|
+
type ConfigureDiscord = typeof ConfigureDiscord.infer;
|
|
2
14
|
declare const Reporter: {
|
|
3
15
|
webhookUrl: string;
|
|
4
16
|
log: (logObj: LogObject) => void;
|
|
5
17
|
};
|
|
6
18
|
export default Reporter;
|
|
19
|
+
export { ConfigureDiscord, Discord };
|
package/package.json
CHANGED
package/src/discord.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ConfigureDiscord, Discord } from "./reporters/discord.js";
|
|
2
|
+
import { type } from "arktype";
|
|
3
|
+
|
|
4
|
+
enum color {
|
|
5
|
+
green = "2404635",
|
|
6
|
+
red = "11606811",
|
|
7
|
+
yellow = "11644443",
|
|
8
|
+
}
|
|
9
|
+
const green = color.green;
|
|
10
|
+
const red = color.red;
|
|
11
|
+
const yellow = color.yellow;
|
|
12
|
+
|
|
13
|
+
const log = (
|
|
14
|
+
level: "debug" | "info" | "log" | "error",
|
|
15
|
+
color: color | string,
|
|
16
|
+
title: string,
|
|
17
|
+
message: string
|
|
18
|
+
) => {
|
|
19
|
+
const settings: Discord = {
|
|
20
|
+
color,
|
|
21
|
+
discord: true,
|
|
22
|
+
title,
|
|
23
|
+
};
|
|
24
|
+
console[level](message, settings);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const discord = {
|
|
28
|
+
configure: (webhookUrl: string) => {
|
|
29
|
+
type("string.url").assert(webhookUrl);
|
|
30
|
+
const settings: ConfigureDiscord = {
|
|
31
|
+
discord: true,
|
|
32
|
+
setWebhookUrl: webhookUrl,
|
|
33
|
+
};
|
|
34
|
+
console.debug(settings);
|
|
35
|
+
},
|
|
36
|
+
debug: (title: string, message: string, color: color | string = yellow) =>
|
|
37
|
+
log("debug", color, title, message),
|
|
38
|
+
error: (title: string, message: string, color: color | string = red) =>
|
|
39
|
+
log("error", color, title, message),
|
|
40
|
+
info: (title: string, message: string, color: color | string = green) =>
|
|
41
|
+
log("info", color, title, message),
|
|
42
|
+
log: (title: string, message: string, color: color | string = green) =>
|
|
43
|
+
log("log", color, title, message),
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export { color, discord };
|
package/src/index.ts
CHANGED
package/src/reporters/discord.ts
CHANGED
|
@@ -16,6 +16,7 @@ const ConfigureDiscord = type({
|
|
|
16
16
|
});
|
|
17
17
|
|
|
18
18
|
type Discord = typeof Discord.infer;
|
|
19
|
+
type ConfigureDiscord = typeof ConfigureDiscord.infer;
|
|
19
20
|
|
|
20
21
|
const NullDiscord = { discord: false } as const;
|
|
21
22
|
|
|
@@ -97,3 +98,4 @@ const sendToDiscord = async (
|
|
|
97
98
|
};
|
|
98
99
|
|
|
99
100
|
export default Reporter;
|
|
101
|
+
export { ConfigureDiscord, Discord };
|
package/src/index.d.ts
DELETED