Skip to content

Commit

Permalink
Allow hot-reloading of the bridge logger (#1704)
Browse files Browse the repository at this point in the history
* Allow logging to be hot-reloaded

* changelog
  • Loading branch information
Half-Shot authored Apr 27, 2023
1 parent 22c5e36 commit a750678
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/1704.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Bridge logging can now be hot-reloaded.
1 change: 0 additions & 1 deletion config.sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,6 @@ ircService:

# Configuration for logging. Optional. Default: console debug level logging
# only.
# This key CANNOT be hot-reloaded
logging:
# Level to log on console/logfile. One of error|warn|info|debug
level: "debug"
Expand Down
3 changes: 3 additions & 0 deletions src/bridge/IrcBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import { RoomConfig } from "./RoomConfig";
import { PrivacyProtection } from "../irc/PrivacyProtection";
import { TestingOptions } from "../config/TestOpts";
import { MatrixBanSync } from "./MatrixBanSync";
import { configure } from "../logging";
import { IrcPoolClient } from "../pool-service/IrcPoolClient";

const log = getLogger("IrcBridge");
Expand Down Expand Up @@ -279,6 +280,8 @@ export class IrcBridge {
!== JSON.stringify(newConfig.ircService.logging);
if (hasLoggingChanged) {
Logger.configure({ console: newConfig.ircService.logging.level });
configure(newConfig.ircService.logging);
this.config.ircService.logging = newConfig.ircService.logging;
}

const banSyncPromise = this.matrixBanSyncer?.syncRules(this.bridge.getIntent());
Expand Down

0 comments on commit a750678

Please sign in to comment.