@dsh-plugin/dsh-synapse 0.1.0-dev.41044228975 → 0.1.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.
- package/LICENSE +661 -661
- package/README.md +0 -14
- package/package.json +1 -1
- package/vendor/gugle-chat-bot/LICENSE +661 -661
- package/vendor/gugle-chat-bot/package.json +57 -57
- package/vendor/gugle-chat-bot/src/allow-rule.yml +9345 -9345
- package/vendor/gugle-chat-bot/src/api.json +4284 -4284
- package/vendor/gugle-chat-bot/src/command/index.ts +141 -141
- package/vendor/gugle-chat-bot/src/config/features.ts +547 -547
- package/vendor/gugle-chat-bot/src/config/index.ts +184 -184
- package/vendor/gugle-chat-bot/src/config/manager.ts +356 -356
- package/vendor/gugle-chat-bot/src/constants/index.ts +13 -13
- package/vendor/gugle-chat-bot/src/custom.ts +548 -548
- package/vendor/gugle-chat-bot/src/event/index.ts +118 -118
- package/vendor/gugle-chat-bot/src/features/admin/index.ts +414 -414
- package/vendor/gugle-chat-bot/src/features/bili/image/impl/video.ts +39 -39
- package/vendor/gugle-chat-bot/src/features/bili/image/index.ts +37 -37
- package/vendor/gugle-chat-bot/src/features/bili/index.ts +65 -65
- package/vendor/gugle-chat-bot/src/features/bili/template/style/video.css +97 -97
- package/vendor/gugle-chat-bot/src/features/bili/template/video.html +56 -56
- package/vendor/gugle-chat-bot/src/features/discord-bridge/index.ts +1128 -1128
- package/vendor/gugle-chat-bot/src/features/discord-bridge/markdown.ts +105 -105
- package/vendor/gugle-chat-bot/src/features/discord-bridge/slash.ts +355 -355
- package/vendor/gugle-chat-bot/src/features/discord-bridge/source.ts +96 -96
- package/vendor/gugle-chat-bot/src/features/discord-bridge/template/message.html +14 -14
- package/vendor/gugle-chat-bot/src/features/discord-bridge/template/style/message.css +144 -144
- package/vendor/gugle-chat-bot/src/features/github/api.ts +93 -93
- package/vendor/gugle-chat-bot/src/features/github/binding.ts +161 -161
- package/vendor/gugle-chat-bot/src/features/github/image/impl/issue.ts +132 -132
- package/vendor/gugle-chat-bot/src/features/github/image/impl/pr.ts +144 -144
- package/vendor/gugle-chat-bot/src/features/github/image/impl/release.ts +160 -160
- package/vendor/gugle-chat-bot/src/features/github/image/index.ts +310 -310
- package/vendor/gugle-chat-bot/src/features/github/index.ts +302 -302
- package/vendor/gugle-chat-bot/src/features/github/template/issue.html +118 -118
- package/vendor/gugle-chat-bot/src/features/github/template/pull_request.html +125 -125
- package/vendor/gugle-chat-bot/src/features/github/template/release.html +53 -53
- package/vendor/gugle-chat-bot/src/features/github/template/style/issue.css +468 -468
- package/vendor/gugle-chat-bot/src/features/github/template/style/pull_request.css +468 -468
- package/vendor/gugle-chat-bot/src/features/github/template/style/release.css +412 -412
- package/vendor/gugle-chat-bot/src/features/hermes/client.ts +184 -184
- package/vendor/gugle-chat-bot/src/features/hermes/config.ts +210 -210
- package/vendor/gugle-chat-bot/src/features/hermes/context.ts +67 -67
- package/vendor/gugle-chat-bot/src/features/hermes/history.ts +86 -86
- package/vendor/gugle-chat-bot/src/features/hermes/index.ts +1533 -1533
- package/vendor/gugle-chat-bot/src/features/hermes/message.ts +319 -319
- package/vendor/gugle-chat-bot/src/features/hermes/reaction.ts +181 -181
- package/vendor/gugle-chat-bot/src/features/hermes/render.ts +118 -118
- package/vendor/gugle-chat-bot/src/features/hermes/reply-units.ts +331 -331
- package/vendor/gugle-chat-bot/src/features/hermes/skills.ts +406 -406
- package/vendor/gugle-chat-bot/src/features/hermes/template/approval.html +30 -30
- package/vendor/gugle-chat-bot/src/features/hermes/template/progress.html +21 -21
- package/vendor/gugle-chat-bot/src/features/hermes/template/style/approval.css +81 -81
- package/vendor/gugle-chat-bot/src/features/hermes/template/style/progress.css +120 -120
- package/vendor/gugle-chat-bot/src/features/hermes/trigger.ts +86 -86
- package/vendor/gugle-chat-bot/src/features/hermes/types.ts +327 -327
- package/vendor/gugle-chat-bot/src/features/management/index.ts +156 -156
- package/vendor/gugle-chat-bot/src/features/minecraft/index.ts +127 -127
- package/vendor/gugle-chat-bot/src/features/modrinth/index.ts +71 -71
- package/vendor/gugle-chat-bot/src/features/parentheses/index.ts +117 -117
- package/vendor/gugle-chat-bot/src/features/peak-valley-timer/index.ts +451 -451
- package/vendor/gugle-chat-bot/src/features/poke/index.ts +24 -24
- package/vendor/gugle-chat-bot/src/features/version-tracker/index.ts +77 -77
- package/vendor/gugle-chat-bot/src/features/welcome/index.ts +57 -57
- package/vendor/gugle-chat-bot/src/github-ip.json +5814 -5814
- package/vendor/gugle-chat-bot/src/image/index.ts +278 -278
- package/vendor/gugle-chat-bot/src/index.ts +695 -695
- package/vendor/gugle-chat-bot/src/logger/index.ts +54 -54
- package/vendor/gugle-chat-bot/src/result.json +359 -359
- package/vendor/gugle-chat-bot/src/type/bili.d.ts +825 -825
- package/vendor/gugle-chat-bot/src/type/event.d.ts +146 -146
- package/vendor/gugle-chat-bot/src/type/github.d.ts +446 -446
- package/vendor/gugle-chat-bot/src/type/index.d.ts +254 -254
- package/vendor/gugle-chat-bot/tsconfig.json +46 -46
- package/scripts/dump-npm-latest.mjs +0 -30
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
// 导入winston库中的createLogger、Logger、transports和format模块,以及dayjs库
|
|
2
|
-
import { createLogger, format, Logger, transports } from 'winston';
|
|
3
|
-
import 'winston-daily-rotate-file';
|
|
4
|
-
import dayjs from 'dayjs';
|
|
5
|
-
|
|
6
|
-
// 定义LoggerFactory类
|
|
7
|
-
export class LoggerFactory {
|
|
8
|
-
/**
|
|
9
|
-
* 创建一个Logger实例
|
|
10
|
-
*
|
|
11
|
-
* @param name 日志的名称,用于在日志条目中标识,可选,默认为undefined
|
|
12
|
-
* @param path 日志文件的存储路径,可选,默认为当前工作目录
|
|
13
|
-
* @param logLevel 日志级别,可选,默认为'info',可选值包括'debug'、'info'、'warn'和'error'
|
|
14
|
-
* @returns 返回一个配置好的Logger实例
|
|
15
|
-
*/
|
|
16
|
-
public static createLogger(
|
|
17
|
-
name: string | undefined = undefined,
|
|
18
|
-
path: string = process.cwd(),
|
|
19
|
-
logLevel: 'debug' | 'info' | 'warn' | 'error' = 'info'
|
|
20
|
-
): Logger {
|
|
21
|
-
// 配置文件日志输出
|
|
22
|
-
const dailyRotateFile = new transports.DailyRotateFile({
|
|
23
|
-
// 指定日志文件的名称和路径
|
|
24
|
-
filename: `%DATE%.log`,
|
|
25
|
-
dirname: path,
|
|
26
|
-
datePattern: 'YYYY-MM-DD',
|
|
27
|
-
// 使用自定义打印格式
|
|
28
|
-
format: format.printf(
|
|
29
|
-
info => `[${dayjs().format('YYYY-MM-DD HH:mm:ss')}]${name ? `[${name}]` : ''}[${info.level}] ${info.message}`
|
|
30
|
-
),
|
|
31
|
-
maxSize: '16k',
|
|
32
|
-
zippedArchive: true
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
// 配置控制台日志输出
|
|
36
|
-
const console = new transports.Console({
|
|
37
|
-
// 结合颜色格式化和自定义打印格式
|
|
38
|
-
format: format.combine(
|
|
39
|
-
format.colorize(),
|
|
40
|
-
format.printf(
|
|
41
|
-
info => `[${dayjs().format('YYYY-MM-DD HH:mm:ss')}]${name ? `[${name}]` : ''}[${info.level}] ${info.message}`
|
|
42
|
-
)
|
|
43
|
-
)
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
// 使用winston的createLogger方法创建并返回一个Logger实例
|
|
47
|
-
return createLogger({
|
|
48
|
-
// 设置日志级别
|
|
49
|
-
level: logLevel,
|
|
50
|
-
// 配置日志传输(输出)的方式,包括控制台和文件
|
|
51
|
-
transports: [console, dailyRotateFile]
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}
|
|
1
|
+
// 导入winston库中的createLogger、Logger、transports和format模块,以及dayjs库
|
|
2
|
+
import { createLogger, format, Logger, transports } from 'winston';
|
|
3
|
+
import 'winston-daily-rotate-file';
|
|
4
|
+
import dayjs from 'dayjs';
|
|
5
|
+
|
|
6
|
+
// 定义LoggerFactory类
|
|
7
|
+
export class LoggerFactory {
|
|
8
|
+
/**
|
|
9
|
+
* 创建一个Logger实例
|
|
10
|
+
*
|
|
11
|
+
* @param name 日志的名称,用于在日志条目中标识,可选,默认为undefined
|
|
12
|
+
* @param path 日志文件的存储路径,可选,默认为当前工作目录
|
|
13
|
+
* @param logLevel 日志级别,可选,默认为'info',可选值包括'debug'、'info'、'warn'和'error'
|
|
14
|
+
* @returns 返回一个配置好的Logger实例
|
|
15
|
+
*/
|
|
16
|
+
public static createLogger(
|
|
17
|
+
name: string | undefined = undefined,
|
|
18
|
+
path: string = process.cwd(),
|
|
19
|
+
logLevel: 'debug' | 'info' | 'warn' | 'error' = 'info'
|
|
20
|
+
): Logger {
|
|
21
|
+
// 配置文件日志输出
|
|
22
|
+
const dailyRotateFile = new transports.DailyRotateFile({
|
|
23
|
+
// 指定日志文件的名称和路径
|
|
24
|
+
filename: `%DATE%.log`,
|
|
25
|
+
dirname: path,
|
|
26
|
+
datePattern: 'YYYY-MM-DD',
|
|
27
|
+
// 使用自定义打印格式
|
|
28
|
+
format: format.printf(
|
|
29
|
+
info => `[${dayjs().format('YYYY-MM-DD HH:mm:ss')}]${name ? `[${name}]` : ''}[${info.level}] ${info.message}`
|
|
30
|
+
),
|
|
31
|
+
maxSize: '16k',
|
|
32
|
+
zippedArchive: true
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// 配置控制台日志输出
|
|
36
|
+
const console = new transports.Console({
|
|
37
|
+
// 结合颜色格式化和自定义打印格式
|
|
38
|
+
format: format.combine(
|
|
39
|
+
format.colorize(),
|
|
40
|
+
format.printf(
|
|
41
|
+
info => `[${dayjs().format('YYYY-MM-DD HH:mm:ss')}]${name ? `[${name}]` : ''}[${info.level}] ${info.message}`
|
|
42
|
+
)
|
|
43
|
+
)
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// 使用winston的createLogger方法创建并返回一个Logger实例
|
|
47
|
+
return createLogger({
|
|
48
|
+
// 设置日志级别
|
|
49
|
+
level: logLevel,
|
|
50
|
+
// 配置日志传输(输出)的方式,包括控制台和文件
|
|
51
|
+
transports: [console, dailyRotateFile]
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|