Skip to content

Commit f8a0631

Browse files
pslaskibsuieric
authored andcommitted
ETCM-671: replaced actor logging with normal logging
1 parent e9f0cf7 commit f8a0631

File tree

2 files changed

+13
-16
lines changed

2 files changed

+13
-16
lines changed

src/main/scala/io/iohk/ethereum/blockchain/sync/regular/BlockFetcher.scala

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,29 @@
11
package io.iohk.ethereum.blockchain.sync.regular
22

33
import akka.actor.Status.Failure
4-
import akka.actor.{Actor, ActorLogging, ActorRef, Props}
4+
import akka.actor.{Actor, ActorRef, Props}
55
import akka.pattern.{ask, pipe}
66
import akka.util.{ByteString, Timeout}
77
import cats.data.NonEmptyList
88
import cats.instances.option._
99
import cats.syntax.either._
10-
import io.iohk.ethereum.consensus.validators.BlockValidator
1110
import io.iohk.ethereum.blockchain.sync.PeersClient._
12-
import io.iohk.ethereum.blockchain.sync.regular.BlockFetcherState.{
13-
AwaitingBodiesToBeIgnored,
14-
AwaitingHeadersToBeIgnored
15-
}
11+
import io.iohk.ethereum.blockchain.sync.regular.BlockFetcherState.{AwaitingBodiesToBeIgnored, AwaitingHeadersToBeIgnored}
1612
import io.iohk.ethereum.blockchain.sync.regular.BlockImporter.{ImportNewBlock, NewCheckpointBlock, NotOnTop, OnTop}
1713
import io.iohk.ethereum.blockchain.sync.regular.RegularSync.ProgressProtocol
14+
import io.iohk.ethereum.consensus.validators.BlockValidator
1815
import io.iohk.ethereum.crypto.kec256
1916
import io.iohk.ethereum.domain._
2017
import io.iohk.ethereum.network.PeerEventBusActor.PeerEvent.MessageFromPeer
2118
import io.iohk.ethereum.network.PeerEventBusActor.SubscriptionClassifier.MessageClassifier
2219
import io.iohk.ethereum.network.PeerEventBusActor.{PeerSelector, Subscribe, Unsubscribe}
2320
import io.iohk.ethereum.network.PeerId
24-
import io.iohk.ethereum.network.p2p.messages.{Codes, CommonMessages, PV64}
2521
import io.iohk.ethereum.network.p2p.messages.PV62._
2622
import io.iohk.ethereum.network.p2p.messages.PV63.{GetNodeData, NodeData}
27-
import io.iohk.ethereum.utils.ByteStringUtils
23+
import io.iohk.ethereum.network.p2p.messages.{Codes, CommonMessages, PV64}
2824
import io.iohk.ethereum.utils.Config.SyncConfig
2925
import io.iohk.ethereum.utils.FunctorOps._
26+
import io.iohk.ethereum.utils.{ByteStringUtils, Logger}
3027
import monix.eval.Task
3128
import monix.execution.{Scheduler => MonixScheduler}
3229
import mouse.all._
@@ -40,7 +37,7 @@ class BlockFetcher(
4037
val syncConfig: SyncConfig,
4138
val blockValidator: BlockValidator
4239
) extends Actor
43-
with ActorLogging {
40+
with Logger {
4441

4542
import BlockFetcher._
4643

@@ -365,7 +362,7 @@ class BlockFetcher(
365362
.tap(blacklistPeerOnFailedRequest)
366363
.flatMap(handleRequestResult(responseFallback))
367364
.onErrorHandle { error =>
368-
log.error(error, "Unexpected error while doing a request")
365+
log.error("Unexpected error while doing a request", error)
369366
responseFallback
370367
}
371368

@@ -381,7 +378,7 @@ class BlockFetcher(
381378
case NoSuitablePeer =>
382379
Task.now(fallback).delayExecution(syncConfig.syncRetryInterval)
383380
case Failure(cause) =>
384-
log.error(cause, "Unexpected error on the request result")
381+
log.error("Unexpected error on the request result", cause)
385382
Task.now(fallback)
386383
case m =>
387384
Task.now(m)

src/main/scala/io/iohk/ethereum/blockchain/sync/regular/BlockImporter.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package io.iohk.ethereum.blockchain.sync.regular
22

33
import akka.actor.Actor.Receive
4-
import akka.actor.{Actor, ActorLogging, ActorRef, NotInfluenceReceiveTimeout, Props, ReceiveTimeout}
4+
import akka.actor.{Actor, ActorRef, NotInfluenceReceiveTimeout, Props, ReceiveTimeout}
55
import akka.util.ByteString
66
import cats.data.NonEmptyList
77
import cats.implicits._
@@ -17,7 +17,7 @@ import io.iohk.ethereum.network.PeerId
1717
import io.iohk.ethereum.ommers.OmmersPool.AddOmmers
1818
import io.iohk.ethereum.transactions.PendingTransactionsManager
1919
import io.iohk.ethereum.transactions.PendingTransactionsManager.{AddUncheckedTransactions, RemoveTransactions}
20-
import io.iohk.ethereum.utils.ByteStringUtils
20+
import io.iohk.ethereum.utils.{ByteStringUtils, Logger}
2121
import io.iohk.ethereum.utils.Config.SyncConfig
2222
import io.iohk.ethereum.utils.FunctorOps._
2323
import monix.eval.Task
@@ -37,7 +37,7 @@ class BlockImporter(
3737
checkpointBlockGenerator: CheckpointBlockGenerator,
3838
supervisor: ActorRef
3939
) extends Actor
40-
with ActorLogging {
40+
with Logger {
4141
import BlockImporter._
4242

4343
implicit val ec: Scheduler = Scheduler(context.dispatcher)
@@ -249,7 +249,7 @@ class BlockImporter(
249249
informFetcherOnFail: Boolean,
250250
internally: Boolean
251251
): ImportFn = {
252-
def doLog(entry: ImportMessages.LogEntry): Unit = log.log(entry._1, entry._2)
252+
def doLog(entry: ImportMessages.LogEntry): Unit = log.info(entry._2)//log.log(entry._1, entry._2)
253253
importWith(
254254
{
255255
Task(doLog(importMessages.preImport()))
@@ -307,7 +307,7 @@ class BlockImporter(
307307

308308
importTask
309309
.map(self ! ImportDone(_, blockImportType))
310-
.onErrorHandle(ex => log.error(ex, ex.getMessage))
310+
.onErrorHandle(ex => log.error(ex.getMessage, ex))
311311
.timed
312312
.map { case (timeTaken, _) => blockImportType.recordMetric(timeTaken.length) }
313313
.runAsyncAndForget

0 commit comments

Comments
 (0)