koishi-plugin-githubsth 1.0.1-test4 → 1.0.1-test5

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/lib/index.js CHANGED
@@ -53,7 +53,8 @@ exports.inject = {
53
53
  };
54
54
  __exportStar(require("./config"), exports);
55
55
  function apply(ctx, config) {
56
- console.log('[GithubSth] Plugin loading...');
56
+ const logger = ctx.logger('githubsth');
57
+ logger.info('Plugin loading...');
57
58
  // 本地化
58
59
  ctx.i18n.define('zh-CN', zh_CN_1.default);
59
60
  // 数据库
@@ -65,9 +66,9 @@ function apply(ctx, config) {
65
66
  // admin and subscribe are already loaded in commands/index.ts, remove duplicate loading here
66
67
  try {
67
68
  ctx.plugin(commands, config);
68
- console.log('[GithubSth] Plugin loaded successfully');
69
+ logger.info('Plugin loaded successfully');
69
70
  }
70
71
  catch (e) {
71
- console.error('[GithubSth] Plugin failed to load:', e);
72
+ logger.error('Plugin failed to load:', e);
72
73
  }
73
74
  }
@@ -23,7 +23,7 @@ class Notifier extends koishi_1.Service {
23
23
  }
24
24
  async handleEvent(event, payload) {
25
25
  // FORCE LOG for debugging
26
- console.log(`[GithubSth] Received event: ${event}`);
26
+ this.ctx.logger('githubsth').info(`Received event: ${event}`);
27
27
  let repoName = payload.repository?.full_name;
28
28
  // Try to fallback if repoName is missing
29
29
  if (!repoName && payload.issue?.repository_url) {
@@ -36,13 +36,13 @@ class Notifier extends koishi_1.Service {
36
36
  repoName = payload.pull_request.base.repo.full_name;
37
37
  }
38
38
  if (!repoName) {
39
- console.log(`[GithubSth] Missing repo info for event: ${event}`);
39
+ this.ctx.logger('githubsth').warn(`Missing repo info for event: ${event}`);
40
40
  if (this.config.debug) {
41
41
  this.ctx.logger('notifier').warn(`Event ${event} missing repository info. Keys: ${Object.keys(payload).join(', ')}`);
42
42
  }
43
43
  return;
44
44
  }
45
- console.log(`[GithubSth] Processing event ${event} for ${repoName}`);
45
+ this.ctx.logger('githubsth').info(`Processing event ${event} for ${repoName}`);
46
46
  if (this.config.debug) {
47
47
  this.ctx.logger('notifier').info(`Received event ${event} for ${repoName}`);
48
48
  this.ctx.logger('notifier').debug(JSON.stringify(payload, null, 2));
@@ -64,13 +64,13 @@ class Notifier extends koishi_1.Service {
64
64
  return true;
65
65
  });
66
66
  if (matchedRules.length === 0) {
67
- console.log(`[GithubSth] No matching rules for ${repoName}`);
67
+ this.ctx.logger('githubsth').info(`No matching rules for ${repoName}`);
68
68
  if (this.config.debug) {
69
69
  this.ctx.logger('notifier').debug(`No matching rules for ${repoName} (event: ${event})`);
70
70
  }
71
71
  return;
72
72
  }
73
- console.log(`[GithubSth] Found ${matchedRules.length} matching rules for ${repoName}`);
73
+ this.ctx.logger('githubsth').info(`Found ${matchedRules.length} matching rules for ${repoName}`);
74
74
  if (this.config.debug) {
75
75
  this.ctx.logger('notifier').debug(`Found ${matchedRules.length} matching rules for ${repoName}`);
76
76
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koishi-plugin-githubsth",
3
- "version": "1.0.1-test4",
3
+ "version": "1.0.1-test5",
4
4
  "description": "Github Subscriptions Notifications, push notifications for GitHub subscriptions For koishi",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",