mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2024-11-19 01:40:55 +01:00
Implement KeyManagerLogger (#1386)
This commit is contained in:
parent
44c9228c26
commit
b561e47d6b
@ -418,7 +418,7 @@ lazy val docs = project
|
||||
lazy val keyManager = project
|
||||
.in(file("key-manager"))
|
||||
.settings(CommonSettings.prodSettings: _*)
|
||||
.dependsOn(core)
|
||||
.dependsOn(core, dbCommons)
|
||||
|
||||
lazy val keyManagerTest = project
|
||||
.in(file("key-manager-test"))
|
||||
|
@ -0,0 +1,26 @@
|
||||
package org.bitcoins.keymanager
|
||||
|
||||
import org.bitcoins.db.{AppLoggers, LoggerConfig}
|
||||
import org.slf4j.Logger
|
||||
|
||||
/** Exposes access to the key manager logger */
|
||||
private[bitcoins] trait KeyManagerLogger {
|
||||
private var _logger: Logger = _
|
||||
protected[bitcoins] def logger(implicit config: LoggerConfig): Logger = {
|
||||
if (_logger == null) {
|
||||
_logger = KeyManagerLoggerImpl(config).getLogger
|
||||
}
|
||||
_logger
|
||||
}
|
||||
}
|
||||
|
||||
private[keymanager] case class KeyManagerLoggerImpl(
|
||||
override val conf: LoggerConfig)
|
||||
extends AppLoggers {
|
||||
|
||||
/**
|
||||
* @return the generic Key Manager logger (i.e. everything related to secret keys)
|
||||
*/
|
||||
def getLogger: Logger =
|
||||
getLoggerImpl(LoggerKind.KeyHandling)
|
||||
}
|
@ -27,7 +27,8 @@ case class BIP39KeyManager(
|
||||
kmParams: KeyManagerParams,
|
||||
private val bip39PasswordOpt: Option[String],
|
||||
creationTime: Instant)
|
||||
extends KeyManager {
|
||||
extends KeyManager
|
||||
with KeyManagerLogger {
|
||||
private val seed = bip39PasswordOpt match {
|
||||
case Some(pw) =>
|
||||
BIP39Seed.fromMnemonic(mnemonic = mnemonic, password = pw)
|
||||
|
Loading…
Reference in New Issue
Block a user