Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow hot-reloading of the bridge logger #1704

Merged
merged 3 commits into from
Apr 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/1704.feature
@@ -0,0 +1 @@
Bridge logging can now be hot-reloaded.
1 change: 0 additions & 1 deletion config.sample.yaml
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
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