mirror of
https://github.com/matrix-org/mjolnir.git
synced 2024-10-01 01:36:06 -04:00
Add a config flag to reduce logging noise
This commit is contained in:
parent
84682db9b0
commit
0575c56b74
@ -33,6 +33,10 @@ managementRoom: "#moderators:example.org"
|
||||
# Set to false to make the management room a bit quieter.
|
||||
verboseLogging: true
|
||||
|
||||
# The log level for the logs themselves. One of DEBUG, INFO, WARN, and ERROR.
|
||||
# This should be at INFO or DEBUG in order to get support for Mjolnir problems.
|
||||
logLevel: "INFO"
|
||||
|
||||
# Set to false to disable synchronizing the ban lists on startup. If true, this
|
||||
# is the same as running !mjolnir sync immediately after startup.
|
||||
syncOnStartup: true
|
||||
|
@ -28,6 +28,7 @@ interface IConfig {
|
||||
autojoin: boolean;
|
||||
managementRoom: string;
|
||||
verboseLogging: boolean;
|
||||
logLevel: "DEBUG" | "INFO" | "WARN" | "ERROR";
|
||||
syncOnStartup: boolean;
|
||||
verifyPermissionsOnStartup: boolean;
|
||||
noop: boolean;
|
||||
|
@ -17,6 +17,7 @@ limitations under the License.
|
||||
import * as path from "path";
|
||||
import {
|
||||
AutojoinRoomsMixin,
|
||||
LogLevel,
|
||||
LogService,
|
||||
MatrixClient,
|
||||
PantalaimonClient,
|
||||
@ -29,6 +30,9 @@ import BanList from "./models/BanList";
|
||||
import { Mjolnir } from "./Mjolnir";
|
||||
|
||||
LogService.setLogger(new RichConsoleLogger());
|
||||
LogService.setLevel(LogLevel.fromString(config.logLevel, LogLevel.DEBUG));
|
||||
|
||||
LogService.info("index", "Starting bot...");
|
||||
|
||||
(async function () {
|
||||
const storage = new SimpleFsStorageProvider(path.join(config.dataPath, "bot.json"));
|
||||
@ -69,6 +73,4 @@ LogService.setLogger(new RichConsoleLogger());
|
||||
|
||||
const bot = new Mjolnir(client, managementRoomId, protectedRooms, banLists);
|
||||
await bot.start();
|
||||
|
||||
LogService.info("index", "Bot started!")
|
||||
})();
|
||||
|
Loading…
Reference in New Issue
Block a user