mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-21 13:27:00 +08:00
This commit is contained in:
parent
10af69f05e
commit
53883e885c
@ -408,7 +408,7 @@ public open class BotConfiguration { // open for Java
|
||||
@ConfigurationDsl
|
||||
public fun redirectBotLogToFile(
|
||||
file: File = File("mirai.log"),
|
||||
identity: (bot: Bot) -> String = { "Net ${it.id}" }
|
||||
identity: (bot: Bot) -> String = { "Bot ${it.id}" }
|
||||
) {
|
||||
require(!file.isDirectory) { "file must not be a dir" }
|
||||
botLoggerSupplier = { SingleFileLogger(identity(it), workingDir.resolve(file)) }
|
||||
@ -425,7 +425,7 @@ public open class BotConfiguration { // open for Java
|
||||
public fun redirectBotLogToDirectory(
|
||||
dir: File = File("logs"),
|
||||
retain: Long = 1.weeksToMillis,
|
||||
identity: (bot: Bot) -> String = { "Net ${it.id}" }
|
||||
identity: (bot: Bot) -> String = { "Bot ${it.id}" }
|
||||
) {
|
||||
require(!dir.isFile) { "dir must not be a file" }
|
||||
botLoggerSupplier = { DirectoryLogger(identity(it), workingDir.resolve(dir), retain) }
|
||||
@ -644,4 +644,4 @@ internal val deviceInfoStub: (Bot) -> DeviceInfo = {
|
||||
|
||||
private val logger by lazy {
|
||||
MiraiLogger.Factory.create(BotConfiguration::class)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user