Fix Masking in Actor Logging (#1761)

Replace ActorLogging with SLF4J logger
to enable masking.
This commit is contained in:
Dmitry Bushev 2021-06-03 12:59:34 +03:00 committed by GitHub
parent 48bbce54de
commit 46f101a2ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
90 changed files with 471 additions and 388 deletions

View File

@ -1,7 +1,7 @@
package org.enso.languageserver.boot.resource
import com.typesafe.scalalogging.LazyLogging
import org.enso.languageserver.data.DirectoriesConfig
import org.slf4j.LoggerFactory
import scala.concurrent.{ExecutionContext, Future}
@ -11,15 +11,14 @@ import scala.concurrent.{ExecutionContext, Future}
*/
class DirectoriesInitialization(directoriesConfig: DirectoriesConfig)(implicit
ec: ExecutionContext
) extends InitializationComponent {
private val log = LoggerFactory.getLogger(this.getClass)
) extends InitializationComponent
with LazyLogging {
/** @inheritdoc */
override def init(): Future[InitializationComponent.Initialized.type] =
Future {
directoriesConfig.createDirectories()
log.info("Initialized directories.")
logger.info("Initialized directories.")
InitializationComponent.Initialized
}
}

View File

@ -4,12 +4,12 @@ import java.io.IOException
import java.nio.file.{FileSystemException, Files, NoSuchFileException}
import akka.event.EventStream
import com.typesafe.scalalogging.LazyLogging
import org.apache.commons.io.FileUtils
import org.enso.languageserver.data.DirectoriesConfig
import org.enso.languageserver.event.InitializedEvent
import org.enso.logger.masking.MaskedPath
import org.enso.searcher.sql.{SqlDatabase, SqlSuggestionsRepo, SqlVersionsRepo}
import org.slf4j.LoggerFactory
import scala.concurrent.{ExecutionContext, Future}
import scala.util.control.NonFatal
@ -28,9 +28,8 @@ class RepoInitialization(
suggestionsRepo: SqlSuggestionsRepo,
versionsRepo: SqlVersionsRepo
)(implicit ec: ExecutionContext)
extends InitializationComponent {
private val log = LoggerFactory.getLogger(this.getClass)
extends InitializationComponent
with LazyLogging {
/** @inheritdoc */
override def init(): Future[InitializationComponent.Initialized.type] =
@ -43,7 +42,7 @@ class RepoInitialization(
val initAction =
for {
_ <- Future {
log.info(
logger.info(
"Initializing suggestions repo [{}].",
MaskedPath(directoriesConfig.suggestionsDatabaseFile.toPath)
)
@ -52,7 +51,7 @@ class RepoInitialization(
recoverInitError(error, suggestionsRepo.db)
}
_ <- Future {
log.info(
logger.info(
"Initialized Suggestions repo [{}].",
MaskedPath(directoriesConfig.suggestionsDatabaseFile.toPath)
)
@ -62,7 +61,7 @@ class RepoInitialization(
case Success(()) =>
eventStream.publish(InitializedEvent.SuggestionsRepoInitialized)
case Failure(ex) =>
log.error(
logger.error(
"Failed to initialize SQL suggestions repo [{}]. {}",
MaskedPath(directoriesConfig.suggestionsDatabaseFile.toPath),
ex.getMessage
@ -75,14 +74,14 @@ class RepoInitialization(
val initAction =
for {
_ <- Future {
log.info(
logger.info(
"Initializing versions repo [{}].",
MaskedPath(directoriesConfig.suggestionsDatabaseFile.toPath)
)
}
_ <- versionsRepo.init
_ <- Future {
log.info(
logger.info(
"Initialized Versions repo [{}].",
MaskedPath(directoriesConfig.suggestionsDatabaseFile.toPath)
)
@ -92,7 +91,7 @@ class RepoInitialization(
case Success(()) =>
eventStream.publish(InitializedEvent.FileVersionsRepoInitialized)
case Failure(ex) =>
log.error(
logger.error(
"Failed to initialize SQL versions repo [{}]. {}",
MaskedPath(directoriesConfig.suggestionsDatabaseFile.toPath),
ex.getMessage
@ -107,7 +106,7 @@ class RepoInitialization(
): Future[Unit] =
for {
_ <- Future {
log.warn(
logger.warn(
"Failed to initialize the suggestions database [{}]. {}",
MaskedPath(directoriesConfig.suggestionsDatabaseFile.toPath),
error.getMessage
@ -117,18 +116,18 @@ class RepoInitialization(
_ <- clearDatabaseFile()
_ <- Future(db.open())
_ <- Future {
log.info("Retrying database initialization.")
logger.info("Retrying database initialization.")
}
_ <- suggestionsRepo.init
} yield ()
private def clearDatabaseFile(retries: Int = 0): Future[Unit] = {
Future {
log.info("Clear database file. Attempt #{}.", retries + 1)
logger.info("Clear database file. Attempt #{}.", retries + 1)
Files.delete(directoriesConfig.suggestionsDatabaseFile.toPath)
}.recoverWith {
case _: NoSuchFileException =>
log.warn(
logger.warn(
"Failed to delete the database file. Attempt #{}. " +
"File does not exist [{}].",
retries + 1,
@ -136,7 +135,7 @@ class RepoInitialization(
)
Future.successful(())
case error: FileSystemException =>
log.error(
logger.error(
s"Failed to delete the database file. Attempt #${retries + 1}." +
s"The file will be removed during the shutdown. ${error.getMessage}."
)
@ -145,7 +144,7 @@ class RepoInitialization(
)
Future.failed(error)
case error: IOException =>
log.error(
logger.error(
"Failed to delete the database file. Attempt #{}. {}",
retries + 1,
error.getMessage

View File

@ -1,10 +1,10 @@
package org.enso.languageserver.boot.resource
import akka.event.EventStream
import com.typesafe.scalalogging.LazyLogging
import org.enso.languageserver.event.InitializedEvent
import org.enso.polyglot.LanguageInfo
import org.graalvm.polyglot.Context
import org.slf4j.LoggerFactory
import scala.concurrent.{ExecutionContext, Future}
@ -18,16 +18,15 @@ class TruffleContextInitialization(
truffleContext: Context
)(implicit
ec: ExecutionContext
) extends InitializationComponent {
private val log = LoggerFactory.getLogger(this.getClass)
) extends InitializationComponent
with LazyLogging {
/** @inheritdoc */
override def init(): Future[InitializationComponent.Initialized.type] =
Future {
truffleContext.initialize(LanguageInfo.ID)
eventStream.publish(InitializedEvent.TruffleContextInitialized)
log.info("Initialized Runtime context.")
logger.info("Initialized Runtime context.")
InitializationComponent.Initialized
}
}

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.capability
import akka.actor.{Actor, ActorLogging, ActorRef, Props}
import akka.actor.{Actor, ActorRef, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.languageserver.capability.CapabilityProtocol.{
AcquireCapability,
ReleaseCapability
@ -28,7 +29,7 @@ class CapabilityRouter(
receivesTreeUpdatesHandler: ActorRef,
suggestionsHandler: ActorRef
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
override def receive: Receive = {

View File

@ -1,8 +1,9 @@
package org.enso.languageserver.filemanager
import akka.actor.{Actor, ActorLogging, Props}
import akka.actor.{Actor, Props}
import akka.routing.SmallestMailboxPool
import akka.pattern.pipe
import com.typesafe.scalalogging.LazyLogging
import org.enso.languageserver.effect._
import org.enso.languageserver.data.Config
import org.enso.languageserver.monitoring.MonitoringProtocol.{Ping, Pong}
@ -21,7 +22,7 @@ class FileManager(
fs: FileSystemApi[BlockingIO],
exec: Exec[BlockingIO]
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher

View File

@ -2,9 +2,10 @@ package org.enso.languageserver.filemanager
import java.io.File
import akka.actor.{Actor, ActorLogging, ActorRef, Props}
import akka.actor.{Actor, ActorRef, Props}
import akka.pattern.pipe
import cats.implicits._
import com.typesafe.scalalogging.LazyLogging
import org.enso.languageserver.capability.CapabilityProtocol.{
CapabilityAcquired,
CapabilityAcquisitionFileSystemFailure,
@ -35,7 +36,7 @@ final class PathWatcher(
fs: FileSystemApi[BlockingIO],
exec: Exec[BlockingIO]
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher, PathWatcherProtocol._
@ -57,7 +58,7 @@ final class PathWatcher(
private def uninitializedStage: Receive = { case WatchPath(path, clients) =>
val pathToWatchResult = config
.findContentRoot(path.rootId)
.map(path.toFile(_))
.map(path.toFile)
val result: BlockingIO[FileSystemFailure, Unit] =
for {
pathToWatch <- IO.fromEither(pathToWatchResult)
@ -108,14 +109,14 @@ final class PathWatcher(
stopWatcher()
restartCounter.inc()
if (restartCounter.canRestart) {
log.error(s"Restart on error#${restartCounter.count}", e)
logger.error(s"Restart on error#${restartCounter.count}", e)
context.system.scheduler.scheduleOnce(
config.pathWatcher.restartTimeout,
self,
WatchPath(base, clients)
)
} else {
log.error("Hit maximum number of restarts", e)
logger.error("Hit maximum number of restarts", e)
clients.foreach { client =>
client ! CapabilityForceReleased(
CapabilityRegistration(ReceivesTreeUpdates(base))

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.filemanager
import akka.actor.{Actor, ActorLogging, ActorRef, Props, Terminated}
import akka.actor.{Actor, ActorRef, Props, Terminated}
import com.typesafe.scalalogging.LazyLogging
import org.enso.languageserver.capability.CapabilityProtocol.{
AcquireCapability,
CapabilityNotAcquiredResponse,
@ -54,7 +55,7 @@ final class ReceivesTreeUpdatesHandler(
fs: FileSystemApi[BlockingIO],
exec: Exec[BlockingIO]
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import ReceivesTreeUpdatesHandler._

View File

@ -2,8 +2,9 @@ package org.enso.languageserver.io
import java.util.UUID
import akka.actor.{Actor, ActorLogging, ActorRef, Props}
import akka.actor.{Actor, ActorRef, Props}
import akka.util.ByteString
import com.typesafe.scalalogging.LazyLogging
import org.enso.languageserver.data.ClientId
import org.enso.languageserver.event.{
ExecutionContextCreated,
@ -35,7 +36,7 @@ class InputRedirectionController(
stdInSink: ObservableOutputStream,
sessionRouter: ActorRef
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging
with InputObserver {
@ -48,7 +49,7 @@ class InputRedirectionController(
private def running(liveContexts: Set[ContextData] = Set.empty): Receive = {
case FeedStandardInput(input, isLineTerminated) =>
log.debug("Feeding stdin [{} bytes]", input.length)
logger.debug("Feeding stdin [{} bytes]", input.length)
if (isLineTerminated) {
val bytes =
ByteString.createBuilder
@ -68,7 +69,7 @@ class InputRedirectionController(
context.become(running(liveContexts - ContextData(contextId, owner)))
case ReadBlocked =>
log.debug("Blocked read detected.")
logger.debug("Blocked read detected.")
liveContexts foreach { case ContextData(_, owner) =>
sessionRouter ! DeliverToJsonController(
owner,

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.io
import akka.actor.{Actor, ActorLogging, ActorRef, Props}
import akka.actor.{Actor, ActorRef, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.languageserver.data.ClientId
import org.enso.languageserver.event.JsonSessionTerminated
import org.enso.languageserver.io.InputOutputProtocol.{
@ -26,7 +27,7 @@ class OutputRedirectionController(
outputKind: OutputKind,
sessionRouter: ActorRef
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging
with OutputObserver {

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.monitoring
import akka.actor.{Actor, ActorLogging, Props}
import akka.actor.{Actor, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.languageserver.event.InitializedEvent.{
InitializationFailed,
InitializationFinished
@ -8,7 +9,7 @@ import org.enso.languageserver.event.InitializedEvent.{
import org.enso.languageserver.monitoring.MonitoringProtocol.{IsReady, KO, OK}
/** An actor that monitors if the system is ready to accept requests. */
class ReadinessMonitor() extends Actor with ActorLogging {
class ReadinessMonitor() extends Actor with LazyLogging {
override def preStart(): Unit = {
context.system.eventStream
@ -28,7 +29,7 @@ class ReadinessMonitor() extends Actor with ActorLogging {
context.become(ready())
case InitializationFailed =>
log.error("Initialization failed. Terminating JVM...")
logger.error("Initialization failed. Terminating JVM...")
System.exit(1)
}

View File

@ -3,9 +3,10 @@ package org.enso.languageserver.protocol.binary
import java.nio.ByteBuffer
import java.util.UUID
import akka.actor.{Actor, ActorLogging, ActorRef, Props, Stash}
import akka.actor.{Actor, ActorRef, Props, Stash}
import akka.http.scaladsl.model.RemoteAddress
import com.google.flatbuffers.FlatBufferBuilder
import com.typesafe.scalalogging.LazyLogging
import org.enso.languageserver.event.{
BinarySessionInitialized,
BinarySessionTerminated
@ -56,7 +57,7 @@ class BinaryConnectionController(
requestTimeout: FiniteDuration = 10.seconds
) extends Actor
with Stash
with ActorLogging
with LazyLogging
with UnhandledLogging {
override def receive: Receive =
@ -87,7 +88,7 @@ class BinaryConnectionController(
outboundChannel ! responsePacket
val session = BinarySession(clientId, self)
context.system.eventStream.publish(BinarySessionInitialized(session))
log.info(
logger.info(
"Data session initialized for client: {} [{}].",
clientId,
clientIp
@ -114,7 +115,7 @@ class BinaryConnectionController(
val handler = context.actorOf(handlers(msg.payloadType()))
handler.forward(msg)
} else {
log.error(
logger.error(
"Received InboundMessage with unknown payload type [{}].",
msg.payloadType()
)
@ -129,17 +130,17 @@ class BinaryConnectionController(
maybeDataSession: Option[BinarySession] = None
): Receive = {
case ConnectionClosed =>
log.info("Connection closed [{}].", clientIp)
logger.info("Connection closed [{}].", clientIp)
maybeDataSession.foreach(session =>
context.system.eventStream.publish(BinarySessionTerminated(session))
)
context.stop(self)
case ConnectionFailed(th) =>
log.error(
th,
"An error occurred during processing web socket connection [{}].",
clientIp
logger.error(
"An error occurred during processing web socket connection [{}]. {}",
clientIp,
th.getMessage
)
maybeDataSession.foreach(session =>
context.system.eventStream.publish(BinarySessionTerminated(session))
@ -160,7 +161,7 @@ class BinaryConnectionController(
case EmptyPayload => ErrorFactory.createReceivedEmptyPayloadError()
case DataCorrupted => ErrorFactory.createReceivedCorruptedDataError()
case GenericDecodingFailure(th) =>
log.error(th, "Unrecognized error occurred in binary protocol.")
logger.error("Unrecognized error occurred in binary protocol.", th)
ErrorFactory.createServiceError()
}

View File

@ -1,8 +1,9 @@
package org.enso.languageserver.protocol.json
import akka.actor.{Actor, ActorLogging, ActorRef, Props, Stash, Status}
import akka.actor.{Actor, ActorRef, Props, Stash, Status}
import akka.pattern.pipe
import akka.util.Timeout
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc._
import org.enso.languageserver.boot.resource.InitializationComponent
import org.enso.languageserver.capability.CapabilityApi.{
@ -94,7 +95,7 @@ class JsonConnectionController(
requestTimeout: FiniteDuration = 10.seconds
) extends Actor
with Stash
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher
@ -134,7 +135,7 @@ class JsonConnectionController(
_,
InitProtocolConnection.Params(clientId)
) =>
log.info("Initializing resources.")
logger.info("Initializing resources.")
mainComponent.init().pipeTo(self)
context.become(initializing(webActor, clientId, req, sender()))
@ -152,7 +153,7 @@ class JsonConnectionController(
receiver: ActorRef
): Receive = {
case InitializationComponent.Initialized =>
log.info("RPC session initialized for client [{}].", clientId)
logger.info("RPC session initialized for client [{}].", clientId)
val session = JsonSession(clientId, self)
context.system.eventStream.publish(JsonSessionInitialized(session))
val requestHandlers = createRequestHandlers(session)
@ -164,7 +165,7 @@ class JsonConnectionController(
context.become(initialised(webActor, session, requestHandlers))
case Status.Failure(ex) =>
log.error(ex, "Failed to initialize the resources. {}", ex.getMessage)
logger.error("Failed to initialize the resources. {}", ex.getMessage)
receiver ! ResponseError(Some(request.id), ResourcesInitializationError)
context.become(connected(webActor))

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.capability
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
import akka.actor.{Actor, ActorRef, Cancellable, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc._
import org.enso.languageserver.capability.CapabilityApi.AcquireCapability
import org.enso.languageserver.capability.CapabilityProtocol
@ -28,7 +29,7 @@ class AcquireCapabilityHandler(
timeout: FiniteDuration,
session: JsonSession
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher
@ -52,7 +53,7 @@ class AcquireCapabilityHandler(
cancellable: Cancellable
): Receive = {
case RequestTimeout =>
log.error(
logger.error(
"Acquiring capability for client [{}] timed out.",
session.clientId
)

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.capability
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
import akka.actor.{Actor, ActorRef, Cancellable, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc._
import org.enso.languageserver.capability.CapabilityApi.{
CapabilityNotAcquired,
@ -30,7 +31,7 @@ class ReleaseCapabilityHandler(
timeout: FiniteDuration,
session: JsonSession
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
override def receive: Receive = requestStage
@ -50,7 +51,7 @@ class ReleaseCapabilityHandler(
cancellable: Cancellable
): Receive = {
case RequestTimeout =>
log.error(
logger.error(
"Releasing capability for client [{}] timed out.",
session.clientId
)

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.executioncontext
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
import akka.actor.{Actor, ActorRef, Cancellable, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc._
import org.enso.languageserver.data.{
CanModify,
@ -29,7 +30,7 @@ class CreateHandler(
contextRegistry: ActorRef,
session: JsonSession
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import ContextRegistryProtocol._
@ -51,7 +52,7 @@ class CreateHandler(
cancellable: Cancellable
): Receive = {
case RequestTimeout =>
log.error("Request [{}] timed out.", id)
logger.error("Request [{}] timed out.", id)
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
context.stop(self)

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.executioncontext
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
import akka.actor.{Actor, ActorRef, Cancellable, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc._
import org.enso.languageserver.requesthandler.RequestTimeout
import org.enso.languageserver.runtime.ExecutionApi._
@ -24,7 +25,7 @@ class DestroyHandler(
contextRegistry: ActorRef,
session: JsonSession
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import ContextRegistryProtocol._
@ -50,7 +51,7 @@ class DestroyHandler(
cancellable: Cancellable
): Receive = {
case RequestTimeout =>
log.error("Request [{}] timed out.", id)
logger.error("Request [{}] timed out.", id)
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
context.stop(self)

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.executioncontext
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
import akka.actor.{Actor, ActorRef, Cancellable, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc._
import org.enso.languageserver.requesthandler.RequestTimeout
import org.enso.languageserver.runtime.ExecutionApi._
@ -24,7 +25,7 @@ class PopHandler(
contextRegistry: ActorRef,
session: JsonSession
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import ContextRegistryProtocol._
@ -46,7 +47,7 @@ class PopHandler(
cancellable: Cancellable
): Receive = {
case RequestTimeout =>
log.error("Request [{}] timed out.", id)
logger.error("Request [{}] timed out.", id)
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
context.stop(self)

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.executioncontext
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
import akka.actor.{Actor, ActorRef, Cancellable, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc._
import org.enso.languageserver.requesthandler.RequestTimeout
import org.enso.languageserver.runtime.ExecutionApi._
@ -24,7 +25,7 @@ class PushHandler(
contextRegistry: ActorRef,
session: JsonSession
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import ContextRegistryProtocol._
@ -54,7 +55,7 @@ class PushHandler(
cancellable: Cancellable
): Receive = {
case RequestTimeout =>
log.error("Request [{}] timed out.", id)
logger.error("Request [{}] timed out.", id)
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
context.stop(self)

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.executioncontext
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
import akka.actor.{Actor, ActorRef, Cancellable, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc._
import org.enso.languageserver.requesthandler.RequestTimeout
import org.enso.languageserver.runtime.ExecutionApi._
@ -24,7 +25,7 @@ class RecomputeHandler(
contextRegistry: ActorRef,
session: JsonSession
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import ContextRegistryProtocol._
@ -54,7 +55,7 @@ class RecomputeHandler(
cancellable: Cancellable
): Receive = {
case RequestTimeout =>
log.error("Request [{}] timed out.", id)
logger.error("Request [{}] timed out.", id)
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
context.stop(self)

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.file
import akka.actor._
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc._
import org.enso.languageserver.filemanager.{
FileManagerProtocol,
@ -15,7 +16,7 @@ import scala.concurrent.duration.FiniteDuration
class CopyFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef)
extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher
@ -36,7 +37,7 @@ class CopyFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef)
cancellable: Cancellable
): Receive = {
case Status.Failure(ex) =>
log.error(
logger.error(
"Failure during [{}] operation: {}",
CopyFile,
MaskedString(ex.getMessage)
@ -46,7 +47,7 @@ class CopyFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef)
context.stop(self)
case RequestTimeout =>
log.error("Request [{}] timed out.", id)
logger.error("Request [{}] timed out.", id)
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
context.stop(self)

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.file
import akka.actor._
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc._
import org.enso.languageserver.filemanager.{
FileManagerProtocol,
@ -15,7 +16,7 @@ import scala.concurrent.duration.FiniteDuration
class CreateFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef)
extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher
@ -36,7 +37,7 @@ class CreateFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef)
cancellable: Cancellable
): Receive = {
case Status.Failure(ex) =>
log.error(
logger.error(
"Failure during [{}] operation: {}",
CreateFile,
MaskedString(ex.getMessage)
@ -46,7 +47,7 @@ class CreateFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef)
context.stop(self)
case RequestTimeout =>
log.error("Request [{}] timed out.", id)
logger.error("Request [{}] timed out.", id)
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
context.stop(self)

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.file
import akka.actor._
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc._
import org.enso.languageserver.filemanager.{
FileDeletedEvent,
@ -17,7 +18,7 @@ import scala.concurrent.duration.FiniteDuration
class DeleteFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef)
extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher
@ -39,7 +40,7 @@ class DeleteFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef)
path: Path
): Receive = {
case Status.Failure(ex) =>
log.error(
logger.error(
"Failure during [{}] operation: {}",
DeleteFile,
MaskedString(ex.getMessage)
@ -49,7 +50,7 @@ class DeleteFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef)
context.stop(self)
case RequestTimeout =>
log.error("Request [{}] timed out.", id)
logger.error("Request [{}] timed out.", id)
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
context.stop(self)

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.file
import akka.actor._
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc._
import org.enso.languageserver.filemanager.{
FileManagerProtocol,
@ -15,7 +16,7 @@ import scala.concurrent.duration.FiniteDuration
class ExistsFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef)
extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher
@ -36,7 +37,7 @@ class ExistsFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef)
cancellable: Cancellable
): Receive = {
case Status.Failure(ex) =>
log.error(
logger.error(
"Failure during [{}] operation: {}",
ExistsFile,
MaskedString(ex.getMessage)
@ -46,7 +47,7 @@ class ExistsFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef)
context.stop(self)
case RequestTimeout =>
log.error("Request [{}] timed out.", id)
logger.error("Request [{}] timed out.", id)
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
context.stop(self)

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.file
import akka.actor._
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc._
import org.enso.languageserver.filemanager.{
FileManagerProtocol,
@ -20,7 +21,7 @@ import scala.concurrent.duration.FiniteDuration
*/
class InfoFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef)
extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher
@ -41,7 +42,7 @@ class InfoFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef)
cancellable: Cancellable
): Receive = {
case Status.Failure(ex) =>
log.error(
logger.error(
"Failure during [{}] operation: {}",
InfoFile,
MaskedString(ex.getMessage)
@ -51,7 +52,7 @@ class InfoFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef)
context.stop(self)
case RequestTimeout =>
log.error("Request [{}] timed out.", id)
logger.error("Request [{}] timed out.", id)
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
context.stop(self)

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.file
import akka.actor._
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc._
import org.enso.languageserver.filemanager.{
FileManagerProtocol,
@ -15,7 +16,7 @@ import scala.concurrent.duration.FiniteDuration
class ListFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef)
extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher
@ -36,7 +37,7 @@ class ListFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef)
cancellable: Cancellable
): Receive = {
case Status.Failure(ex) =>
log.error(
logger.error(
"Failure during [{}] operation: {}",
ListFile,
MaskedString(ex.getMessage)
@ -46,7 +47,7 @@ class ListFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef)
context.stop(self)
case RequestTimeout =>
log.error("Request [{}] timed out.", id)
logger.error("Request [{}] timed out.", id)
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
context.stop(self)

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.file
import akka.actor._
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc._
import org.enso.languageserver.filemanager.{
FileManagerProtocol,
@ -15,7 +16,7 @@ import scala.concurrent.duration.FiniteDuration
class MoveFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef)
extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher
@ -36,7 +37,7 @@ class MoveFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef)
cancellable: Cancellable
): Receive = {
case Status.Failure(ex) =>
log.error(
logger.error(
"Failure during [{}] operation: {}",
MoveFile,
MaskedString(ex.getMessage)
@ -46,7 +47,7 @@ class MoveFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef)
context.stop(self)
case RequestTimeout =>
log.error("Request [{}] timed out.", id)
logger.error("Request [{}] timed out.", id)
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
context.stop(self)

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.file
import akka.actor._
import com.typesafe.scalalogging.LazyLogging
import org.enso.languageserver.filemanager.{
FileManagerProtocol,
FileSystemFailureMapper
@ -32,7 +33,7 @@ class ReadBinaryFileHandler(
fileManager: ActorRef,
replyTo: ActorRef
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher
@ -54,7 +55,7 @@ class ReadBinaryFileHandler(
cancellable: Cancellable
): Receive = {
case Status.Failure(ex) =>
log.error(
logger.error(
s"Failure during ReadBinaryFile operation: {}",
MaskedString(ex.getMessage)
)
@ -64,7 +65,7 @@ class ReadBinaryFileHandler(
context.stop(self)
case RequestTimeout =>
log.error("Request ReadBinaryFile [{}] timed out.", requestId)
logger.error("Request ReadBinaryFile [{}] timed out.", requestId)
val packet = ErrorFactory.createServiceError(Some(requestId))
replyTo ! packet
context.stop(self)

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.file
import akka.actor._
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc._
import org.enso.languageserver.filemanager.{
FileManagerProtocol,
@ -17,7 +18,7 @@ class ReadTextualFileHandler(
requestTimeout: FiniteDuration,
fileManager: ActorRef
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher
@ -38,7 +39,7 @@ class ReadTextualFileHandler(
cancellable: Cancellable
): Receive = {
case Status.Failure(ex) =>
log.error(
logger.error(
"Failure during [{}] operation: {}",
ReadFile,
MaskedString(ex.getMessage)
@ -48,7 +49,7 @@ class ReadTextualFileHandler(
context.stop(self)
case RequestTimeout =>
log.error("Request [{}] timed out.", id)
logger.error("Request [{}] timed out.", id)
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
context.stop(self)

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.file
import akka.actor._
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc._
import org.enso.languageserver.filemanager.{
FileManagerProtocol,
@ -15,7 +16,7 @@ import scala.concurrent.duration.FiniteDuration
class TreeFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef)
extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher
@ -36,7 +37,7 @@ class TreeFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef)
cancellable: Cancellable
): Receive = {
case Status.Failure(ex) =>
log.error(
logger.error(
"Failure during [{}] operation: {}",
TreeFile,
MaskedString(ex.getMessage)
@ -46,7 +47,7 @@ class TreeFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef)
context.stop(self)
case RequestTimeout =>
log.error("Request [{}] timed out.", id)
logger.error("Request [{}] timed out.", id)
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
context.stop(self)

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.file
import akka.actor._
import com.typesafe.scalalogging.LazyLogging
import org.enso.languageserver.filemanager.{
FileManagerProtocol,
FileSystemFailureMapper
@ -32,7 +33,7 @@ class WriteBinaryFileHandler(
fileManager: ActorRef,
replyTo: ActorRef
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher
@ -57,7 +58,7 @@ class WriteBinaryFileHandler(
cancellable: Cancellable
): Receive = {
case Status.Failure(ex) =>
log.error(
logger.error(
"Failure during WriteBinaryFile operation: {}",
MaskedString(ex.getMessage)
)
@ -67,7 +68,7 @@ class WriteBinaryFileHandler(
context.stop(self)
case RequestTimeout =>
log.error("Request WriteBinaryFile [{}] timed out.", requestId)
logger.error("Request WriteBinaryFile [{}] timed out.", requestId)
val packet = ErrorFactory.createServiceError(Some(requestId))
replyTo ! packet
context.stop(self)

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.file
import akka.actor._
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc._
import org.enso.languageserver.filemanager.{
FileManagerProtocol,
@ -17,7 +18,7 @@ class WriteTextualFileHandler(
requestTimeout: FiniteDuration,
fileManager: ActorRef
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher
@ -38,7 +39,7 @@ class WriteTextualFileHandler(
cancellable: Cancellable
): Receive = {
case Status.Failure(ex) =>
log.error(
logger.error(
s"Failure during [{}] operation: {}",
WriteFile,
MaskedString(ex.getMessage)
@ -48,7 +49,7 @@ class WriteTextualFileHandler(
context.stop(self)
case RequestTimeout =>
log.error("Request [{}] timed out.", id)
logger.error("Request [{}] timed out.", id)
replyTo ! ResponseError(Some(id), Errors.ServiceError)
context.stop(self)

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.io
import akka.actor.{Actor, ActorLogging, ActorRef, Props}
import akka.actor.{Actor, ActorRef, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc.{Request, ResponseResult, Unused}
import org.enso.languageserver.io.InputOutputApi.FeedStandardInput
import org.enso.languageserver.io.InputOutputProtocol
@ -12,7 +13,7 @@ import org.enso.languageserver.util.UnhandledLogging
*/
class FeedStandardInputHandler(stdInController: ActorRef)
extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
override def receive: Receive = {

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.io
import akka.actor.{Actor, ActorLogging, ActorRef, Props}
import akka.actor.{Actor, ActorRef, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc.{Request, ResponseResult, Unused}
import org.enso.languageserver.data.ClientId
import org.enso.languageserver.io.InputOutputApi.RedirectStandardError
@ -14,7 +15,7 @@ import org.enso.languageserver.util.UnhandledLogging
*/
class RedirectStdErrHandler(stdErrController: ActorRef, clientId: ClientId)
extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
override def receive: Receive = {

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.io
import akka.actor.{Actor, ActorLogging, ActorRef, Props}
import akka.actor.{Actor, ActorRef, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc.{Request, ResponseResult, Unused}
import org.enso.languageserver.data.ClientId
import org.enso.languageserver.io.InputOutputApi.RedirectStandardOutput
@ -14,7 +15,7 @@ import org.enso.languageserver.util.UnhandledLogging
*/
class RedirectStdOutHandler(stdOutController: ActorRef, clientId: ClientId)
extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
override def receive: Receive = {

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.io
import akka.actor.{Actor, ActorLogging, ActorRef, Props}
import akka.actor.{Actor, ActorRef, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc.{Request, ResponseResult, Unused}
import org.enso.languageserver.data.ClientId
import org.enso.languageserver.io.InputOutputApi.SuppressStandardError
@ -14,7 +15,7 @@ import org.enso.languageserver.util.UnhandledLogging
*/
class SuppressStdErrHandler(stdErrController: ActorRef, clientId: ClientId)
extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
override def receive: Receive = {

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.io
import akka.actor.{Actor, ActorLogging, ActorRef, Props}
import akka.actor.{Actor, ActorRef, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc.{Request, ResponseResult, Unused}
import org.enso.languageserver.data.ClientId
import org.enso.languageserver.io.InputOutputApi.SuppressStandardOutput
@ -14,7 +15,7 @@ import org.enso.languageserver.util.UnhandledLogging
*/
class SuppressStdOutHandler(stdOutController: ActorRef, clientId: ClientId)
extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
override def receive: Receive = {

View File

@ -1,13 +1,14 @@
package org.enso.languageserver.requesthandler.monitoring
import akka.actor.{Actor, ActorLogging, ActorRef, Props}
import akka.actor.{Actor, ActorRef, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc.Errors.ServiceError
import org.enso.jsonrpc.{Id, Request, ResponseError, ResponseResult, Unused}
import org.enso.languageserver.event.InitializedEvent
import org.enso.languageserver.monitoring.MonitoringApi
/** A request handler for `heartbeat/init` commands. */
class InitialPingHandler extends Actor with ActorLogging {
class InitialPingHandler extends Actor with LazyLogging {
override def preStart(): Unit = {
context.system.eventStream.subscribe(self, classOf[InitializedEvent])

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.monitoring
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
import akka.actor.{Actor, ActorRef, Cancellable, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc.{
Errors,
Id,
@ -25,7 +26,7 @@ class PingHandler(
timeout: FiniteDuration,
shouldReplyWhenTimedOut: Boolean
) extends Actor
with ActorLogging {
with LazyLogging {
import context.dispatcher
@ -48,7 +49,7 @@ class PingHandler(
count: Int = 0
): Receive = {
case RequestTimeout =>
log.error(
logger.error(
"Health check timed out. Only {}/{} subsystems replied on time.",
count,
subsystems.size

View File

@ -2,7 +2,8 @@ package org.enso.languageserver.requesthandler.refactoring
import java.util.UUID
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
import akka.actor.{Actor, ActorRef, Cancellable, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc._
import org.enso.languageserver.refactoring.ProjectNameChangedEvent
import org.enso.languageserver.refactoring.RefactoringApi.RenameProject
@ -19,7 +20,7 @@ import scala.concurrent.duration.FiniteDuration
*/
class RenameProjectHandler(timeout: FiniteDuration, runtimeConnector: ActorRef)
extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher
@ -49,7 +50,7 @@ class RenameProjectHandler(timeout: FiniteDuration, runtimeConnector: ActorRef)
cancellable: Cancellable
): Receive = {
case RequestTimeout =>
log.error("Request [{}] timed out.", id)
logger.error("Request [{}] timed out.", id)
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
context.stop(self)

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.search
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props, Status}
import akka.actor.{Actor, ActorRef, Cancellable, Props, Status}
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc._
import org.enso.languageserver.requesthandler.RequestTimeout
import org.enso.languageserver.search.SearchApi.{
@ -21,7 +22,7 @@ class CompletionHandler(
timeout: FiniteDuration,
suggestionsHandler: ActorRef
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher
@ -52,13 +53,13 @@ class CompletionHandler(
cancellable: Cancellable
): Receive = {
case Status.Failure(ex) =>
log.error(ex, "Search completion error: {}", ex.getMessage)
logger.error("Search completion error.", ex)
replyTo ! ResponseError(Some(id), SuggestionsDatabaseError)
cancellable.cancel()
context.stop(self)
case RequestTimeout =>
log.error("Request [{}] timed out.", id)
logger.error("Request [{}] timed out.", id)
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
context.stop(self)

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.search
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props, Status}
import akka.actor.{Actor, ActorRef, Cancellable, Props, Status}
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc._
import org.enso.languageserver.requesthandler.RequestTimeout
import org.enso.languageserver.search.SearchApi.{
@ -21,7 +22,7 @@ class GetSuggestionsDatabaseHandler(
timeout: FiniteDuration,
suggestionsHandler: ActorRef
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher
@ -42,13 +43,13 @@ class GetSuggestionsDatabaseHandler(
cancellable: Cancellable
): Receive = {
case Status.Failure(ex) =>
log.error(ex, "GetSuggestionsDatabase error: {}", ex.getMessage)
logger.error("GetSuggestionsDatabase error.", ex)
replyTo ! ResponseError(Some(id), SuggestionsDatabaseError)
cancellable.cancel()
context.stop(self)
case RequestTimeout =>
log.error("Request [{}] timed out.", id)
logger.error("Request [{}] timed out.", id)
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
context.stop(self)

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.search
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props, Status}
import akka.actor.{Actor, ActorRef, Cancellable, Props, Status}
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc._
import org.enso.languageserver.requesthandler.RequestTimeout
import org.enso.languageserver.search.SearchApi.{
@ -21,7 +22,7 @@ class GetSuggestionsDatabaseVersionHandler(
timeout: FiniteDuration,
suggestionsHandler: ActorRef
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher
@ -42,13 +43,13 @@ class GetSuggestionsDatabaseVersionHandler(
cancellable: Cancellable
): Receive = {
case Status.Failure(ex) =>
log.error(ex, "GetSuggestionsDatabaseVersion error: {}", ex.getMessage)
logger.error("GetSuggestionsDatabaseVersion error.", ex)
replyTo ! ResponseError(Some(id), SuggestionsDatabaseError)
cancellable.cancel()
context.stop(self)
case RequestTimeout =>
log.error("Request [{}] timed out.", id)
logger.error("Request [{}] timed out.", id)
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
context.stop(self)

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.search
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props, Status}
import akka.actor.{Actor, ActorRef, Cancellable, Props, Status}
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc._
import org.enso.languageserver.requesthandler.RequestTimeout
import org.enso.languageserver.search.SearchApi.{
@ -21,7 +22,7 @@ class ImportHandler(
timeout: FiniteDuration,
suggestionsHandler: ActorRef
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher
@ -42,13 +43,13 @@ class ImportHandler(
cancellable: Cancellable
): Receive = {
case Status.Failure(ex) =>
log.error(ex, "Search import error: {}", ex.getMessage)
logger.error("Search import error.", ex)
replyTo ! ResponseError(Some(id), SuggestionsDatabaseError)
cancellable.cancel()
context.stop(self)
case RequestTimeout =>
log.error("Request [{}] timed out.", id)
logger.error("Request [{}] timed out.", id)
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
context.stop(self)

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.search
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props, Status}
import akka.actor.{Actor, ActorRef, Cancellable, Props, Status}
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc._
import org.enso.languageserver.requesthandler.RequestTimeout
import org.enso.languageserver.runtime.{
@ -25,7 +26,7 @@ class InvalidateSuggestionsDatabaseHandler(
timeout: FiniteDuration,
suggestionsHandler: ActorRef
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher
@ -46,13 +47,13 @@ class InvalidateSuggestionsDatabaseHandler(
cancellable: Cancellable
): Receive = {
case Status.Failure(ex) =>
log.error(ex, "InvalidateSuggestionsDatabase error: {}", ex.getMessage)
logger.error("InvalidateSuggestionsDatabase error.", ex)
replyTo ! ResponseError(Some(id), SuggestionsDatabaseError)
cancellable.cancel()
context.stop(self)
case RequestTimeout =>
log.error("Request [{}] timed out.", id)
logger.error("Request [{}] timed out.", id)
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
context.stop(self)

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.session
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
import akka.actor.{Actor, ActorRef, Cancellable, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc.{Errors, Id, Request, ResponseError, ResponseResult}
import org.enso.languageserver.filemanager.FileManagerProtocol
import org.enso.languageserver.filemanager.FileManagerProtocol.ContentRootsResult
@ -19,7 +20,7 @@ class InitProtocolConnectionHandler(
fileManager: ActorRef,
timeout: FiniteDuration
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher
@ -40,7 +41,7 @@ class InitProtocolConnectionHandler(
cancellable: Cancellable
): Receive = {
case RequestTimeout =>
log.error("Getting content roots request [{}] timed out.", id)
logger.error("Getting content roots request [{}] timed out.", id)
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
context.stop(self)

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.text
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
import akka.actor.{Actor, ActorRef, Cancellable, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc._
import org.enso.languageserver.requesthandler.RequestTimeout
import org.enso.languageserver.session.JsonSession
@ -22,7 +23,7 @@ class ApplyEditHandler(
timeout: FiniteDuration,
rpcSession: JsonSession
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher
@ -43,7 +44,7 @@ class ApplyEditHandler(
cancellable: Cancellable
): Receive = {
case RequestTimeout =>
log.error(
logger.error(
"Applying edit request [{}] for [{}] timed out.",
id,
rpcSession.clientId

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.text
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
import akka.actor.{Actor, ActorRef, Cancellable, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc._
import org.enso.languageserver.requesthandler.RequestTimeout
import org.enso.languageserver.session.JsonSession
@ -22,7 +23,7 @@ class CloseFileHandler(
timeout: FiniteDuration,
rpcSession: JsonSession
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher
@ -43,7 +44,7 @@ class CloseFileHandler(
cancellable: Cancellable
): Receive = {
case RequestTimeout =>
log.error(
logger.error(
"Closing file request [{}] for [{}] timed out.",
id,
rpcSession.clientId

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.text
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
import akka.actor.{Actor, ActorRef, Cancellable, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc.{Errors, Id, Request, ResponseError, ResponseResult}
import org.enso.languageserver.filemanager.FileSystemFailureMapper
import org.enso.languageserver.requesthandler.RequestTimeout
@ -26,7 +27,7 @@ class OpenFileHandler(
timeout: FiniteDuration,
rpcSession: JsonSession
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher
@ -47,7 +48,7 @@ class OpenFileHandler(
cancellable: Cancellable
): Receive = {
case RequestTimeout =>
log.error(
logger.error(
"Opening file request [{}] for [{}] timed out.",
id,
rpcSession.clientId

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.text
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
import akka.actor.{Actor, ActorRef, Cancellable, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc._
import org.enso.languageserver.filemanager.FileSystemFailureMapper
import org.enso.languageserver.requesthandler.RequestTimeout
@ -28,7 +29,7 @@ class SaveFileHandler(
timeout: FiniteDuration,
rpcSession: JsonSession
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher
@ -53,7 +54,7 @@ class SaveFileHandler(
cancellable: Cancellable
): Receive = {
case RequestTimeout =>
log.error(
logger.error(
"Saving file request [{}] for [{}] timed out.",
id,
rpcSession.clientId

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.visualisation
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
import akka.actor.{Actor, ActorRef, Cancellable, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc._
import org.enso.languageserver.data.ClientId
import org.enso.languageserver.requesthandler.RequestTimeout
@ -24,7 +25,7 @@ class AttachVisualisationHandler(
timeout: FiniteDuration,
contextRegistry: ActorRef
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher
@ -50,7 +51,7 @@ class AttachVisualisationHandler(
cancellable: Cancellable
): Receive = {
case RequestTimeout =>
log.error("Request [{}] timed out.", id)
logger.error("Request [{}] timed out.", id)
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
context.stop(self)

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.visualisation
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
import akka.actor.{Actor, ActorRef, Cancellable, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc._
import org.enso.languageserver.data.ClientId
import org.enso.languageserver.requesthandler.RequestTimeout
@ -24,7 +25,7 @@ class DetachVisualisationHandler(
timeout: FiniteDuration,
contextRegistry: ActorRef
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher
@ -50,7 +51,7 @@ class DetachVisualisationHandler(
cancellable: Cancellable
): Receive = {
case RequestTimeout =>
log.error("Request [{}] timed out.", id)
logger.error("Request [{}] timed out.", id)
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
context.stop(self)

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.visualisation
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
import akka.actor.{Actor, ActorRef, Cancellable, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc._
import org.enso.languageserver.data.ClientId
import org.enso.languageserver.requesthandler.RequestTimeout
@ -24,7 +25,7 @@ class ExecuteExpressionHandler(
timeout: FiniteDuration,
contextRegistry: ActorRef
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher
@ -54,7 +55,7 @@ class ExecuteExpressionHandler(
cancellable: Cancellable
): Receive = {
case RequestTimeout =>
log.error("Request [{}] timed out.", id)
logger.error("Request [{}] timed out.", id)
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
context.stop(self)

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.requesthandler.visualisation
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
import akka.actor.{Actor, ActorRef, Cancellable, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc._
import org.enso.languageserver.data.ClientId
import org.enso.languageserver.requesthandler.RequestTimeout
@ -24,7 +25,7 @@ class ModifyVisualisationHandler(
timeout: FiniteDuration,
contextRegistry: ActorRef
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher
@ -49,7 +50,7 @@ class ModifyVisualisationHandler(
cancellable: Cancellable
): Receive = {
case RequestTimeout =>
log.error("Request [{}] timed out.", id)
logger.error("Request [{}] timed out.", id)
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
context.stop(self)

View File

@ -1,7 +1,8 @@
package org.enso.languageserver.requesthandler.workspace
import akka.actor.{Actor, ActorLogging, Props}
import akka.actor.{Actor, Props}
import buildinfo.Info
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc.{Request, ResponseError, ResponseResult}
import org.enso.languageserver.data.Config
import org.enso.languageserver.filemanager.FileManagerApi
@ -9,7 +10,6 @@ import org.enso.languageserver.util.UnhandledLogging
import org.enso.languageserver.workspace.WorkspaceApi.ProjectInfo
import org.enso.logger.masking.MaskedPath
import org.enso.pkg.{Config => PkgConfig}
import java.io.{File, FileInputStream}
import java.nio.charset.StandardCharsets
@ -17,7 +17,7 @@ import java.nio.charset.StandardCharsets
*/
class ProjectInfoHandler(languageServerConfig: Config)
extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
override def receive: Receive = { case Request(ProjectInfo, id, _) =>
@ -43,14 +43,14 @@ class ProjectInfoHandler(languageServerConfig: Config)
projectInfo
)
} else {
log.error(
logger.error(
"Could not decode the package configuration at [{}].",
MaskedPath(configFile.toPath)
)
sender() ! ResponseError(Some(id), FileManagerApi.CannotDecodeError)
}
} else {
log.error(
logger.error(
"Could not find the package configuration in the project at [{}].",
MaskedPath(projectRoot.toPath)
)

View File

@ -1,7 +1,8 @@
package org.enso.languageserver.runtime
import akka.actor.{Actor, ActorLogging, ActorRef, Props}
import akka.actor.{Actor, ActorRef, Props}
import akka.pattern.pipe
import com.typesafe.scalalogging.LazyLogging
import org.enso.languageserver.data.Config
import org.enso.languageserver.runtime.ContextRegistryProtocol.{
DetachVisualisation,
@ -43,7 +44,7 @@ final class ContextEventsListener(
sessionRouter: ActorRef,
updatesSendRate: FiniteDuration
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import ContextEventsListener.RunExpressionUpdates
@ -195,7 +196,7 @@ final class ContextEventsListener(
methodPointerToSuggestion.get(pointer) match {
case suggestionId @ Some(_) => suggestionId
case None =>
log.error("Unable to find suggestion for [{}].", pointer)
logger.error("Unable to find suggestion for [{}].", pointer)
None
}
},

View File

@ -2,7 +2,8 @@ package org.enso.languageserver.runtime
import java.util.UUID
import akka.actor.{Actor, ActorLogging, ActorRef, Props}
import akka.actor.{Actor, ActorRef, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.languageserver.data.{ClientId, Config}
import org.enso.languageserver.event.{
ExecutionContextCreated,
@ -62,7 +63,7 @@ final class ContextRegistry(
runtime: ActorRef,
sessionRouter: ActorRef
) extends Actor
with ActorLogging
with LazyLogging
with ActorMessageLogging
with UnhandledLogging {

View File

@ -2,7 +2,8 @@ package org.enso.languageserver.runtime
import java.nio.ByteBuffer
import akka.actor.{Actor, ActorLogging, ActorRef, Props, Stash}
import akka.actor.{Actor, ActorRef, Props, Stash}
import com.typesafe.scalalogging.LazyLogging
import org.enso.languageserver.util.UnhandledLogging
import org.enso.languageserver.runtime.RuntimeConnector.Destroy
import org.enso.polyglot.runtime.Runtime
@ -12,17 +13,17 @@ import org.graalvm.polyglot.io.MessageEndpoint
*/
class RuntimeConnector
extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging
with Stash {
override def preStart(): Unit = {
log.info("Starting the runtime connector.")
logger.info("Starting the runtime connector.")
}
override def receive: Receive = {
case RuntimeConnector.Initialize(engine) =>
log.info(
logger.info(
s"Runtime connector established connection with the message endpoint [{}].",
engine
)

View File

@ -2,7 +2,8 @@ package org.enso.languageserver.runtime
import java.util.UUID
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
import akka.actor.{Actor, ActorRef, Cancellable, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.languageserver.runtime.RuntimeKiller._
import org.enso.languageserver.util.UnhandledLogging
import org.enso.polyglot.runtime.Runtime.Api
@ -20,7 +21,7 @@ import scala.util.control.NonFatal
*/
class RuntimeKiller(runtimeConnector: ActorRef, truffleContext: Context)
extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher
@ -28,7 +29,7 @@ class RuntimeKiller(runtimeConnector: ActorRef, truffleContext: Context)
override def receive: Receive = idle()
private def idle(): Receive = { case ShutDownRuntime =>
log.info("Shutting down the runtime server [{}].", runtimeConnector)
logger.info("Shutting down the runtime server [{}].", runtimeConnector)
runtimeConnector ! Api.Request(
UUID.randomUUID(),
Api.ShutDownRuntimeServer()
@ -44,7 +45,7 @@ class RuntimeKiller(runtimeConnector: ActorRef, truffleContext: Context)
cancellable: Cancellable
): Receive = {
case ResourceDisposalTimeout =>
log.error("Disposal of runtime resources timed out.")
logger.error("Disposal of runtime resources timed out.")
shutDownTruffle(replyTo)
case Api.Response(_, Api.RuntimeServerShutDown()) =>
@ -61,7 +62,7 @@ class RuntimeKiller(runtimeConnector: ActorRef, truffleContext: Context)
private def shutDownTruffle(replyTo: ActorRef, retryCount: Int = 0): Unit = {
try {
log.info(
logger.info(
"Shutting down the Truffle context [{}]. " +
"Attempt #{}.",
truffleContext,
@ -72,8 +73,7 @@ class RuntimeKiller(runtimeConnector: ActorRef, truffleContext: Context)
context.stop(self)
} catch {
case NonFatal(ex) =>
log.error(
ex,
logger.error(
s"An error occurred during stopping Truffle context [{}]. {}",
truffleContext,
ex.getMessage

View File

@ -2,7 +2,8 @@ package org.enso.languageserver.runtime.handler
import java.util.UUID
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
import akka.actor.{Actor, ActorRef, Cancellable, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.languageserver.data.Config
import org.enso.languageserver.requesthandler.RequestTimeout
import org.enso.languageserver.runtime.{
@ -25,7 +26,7 @@ class AttachVisualisationHandler(
timeout: FiniteDuration,
runtime: ActorRef
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher

View File

@ -2,7 +2,8 @@ package org.enso.languageserver.runtime.handler
import java.util.UUID
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
import akka.actor.{Actor, ActorRef, Cancellable, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.languageserver.data.Config
import org.enso.languageserver.requesthandler.RequestTimeout
import org.enso.languageserver.runtime.{
@ -25,7 +26,7 @@ final class CreateContextHandler(
timeout: FiniteDuration,
runtime: ActorRef
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher, ContextRegistryProtocol._

View File

@ -2,7 +2,8 @@ package org.enso.languageserver.runtime.handler
import java.util.UUID
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
import akka.actor.{Actor, ActorRef, Cancellable, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.languageserver.data.Config
import org.enso.languageserver.requesthandler.RequestTimeout
import org.enso.languageserver.runtime.{
@ -25,7 +26,7 @@ final class DestroyContextHandler(
timeout: FiniteDuration,
runtime: ActorRef
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher, ContextRegistryProtocol._

View File

@ -2,7 +2,8 @@ package org.enso.languageserver.runtime.handler
import java.util.UUID
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
import akka.actor.{Actor, ActorRef, Cancellable, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.languageserver.data.Config
import org.enso.languageserver.requesthandler.RequestTimeout
import org.enso.languageserver.runtime.{
@ -25,7 +26,7 @@ class DetachVisualisationHandler(
timeout: FiniteDuration,
runtime: ActorRef
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher

View File

@ -2,7 +2,8 @@ package org.enso.languageserver.runtime.handler
import java.util.UUID
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
import akka.actor.{Actor, ActorRef, Cancellable, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.languageserver.data.Config
import org.enso.languageserver.requesthandler.RequestTimeout
import org.enso.languageserver.runtime.{
@ -25,7 +26,7 @@ class ModifyVisualisationHandler(
timeout: FiniteDuration,
runtime: ActorRef
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher

View File

@ -2,7 +2,8 @@ package org.enso.languageserver.runtime.handler
import java.util.UUID
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
import akka.actor.{Actor, ActorRef, Cancellable, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.languageserver.data.Config
import org.enso.languageserver.requesthandler.RequestTimeout
import org.enso.languageserver.runtime.{
@ -25,7 +26,7 @@ final class PopContextHandler(
timeout: FiniteDuration,
runtime: ActorRef
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher

View File

@ -2,7 +2,8 @@ package org.enso.languageserver.runtime.handler
import java.util.UUID
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
import akka.actor.{Actor, ActorRef, Cancellable, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.languageserver.data.Config
import org.enso.languageserver.requesthandler.RequestTimeout
import org.enso.languageserver.runtime.{
@ -25,7 +26,7 @@ final class PushContextHandler(
timeout: FiniteDuration,
runtime: ActorRef
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher

View File

@ -2,7 +2,8 @@ package org.enso.languageserver.runtime.handler
import java.util.UUID
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
import akka.actor.{Actor, ActorRef, Cancellable, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.languageserver.data.Config
import org.enso.languageserver.requesthandler.RequestTimeout
import org.enso.languageserver.runtime.{
@ -25,7 +26,7 @@ final class RecomputeContextHandler(
timeout: FiniteDuration,
runtime: ActorRef
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher, ContextRegistryProtocol._

View File

@ -2,8 +2,9 @@ package org.enso.languageserver.search
import java.util.UUID
import akka.actor.{Actor, ActorLogging, ActorRef, Props, Stash}
import akka.actor.{Actor, ActorRef, Props, Stash}
import akka.pattern.{ask, pipe}
import com.typesafe.scalalogging.LazyLogging
import org.enso.languageserver.capability.CapabilityProtocol.{
AcquireCapability,
CapabilityAcquired,
@ -84,7 +85,7 @@ final class SuggestionsHandler(
runtimeConnector: ActorRef
) extends Actor
with Stash
with ActorLogging
with LazyLogging
with UnhandledLogging {
import SuggestionsHandler.ProjectNameUpdated
@ -93,7 +94,7 @@ final class SuggestionsHandler(
private val timeout = config.executionContext.requestTimeout
override def preStart(): Unit = {
log.info(
logger.info(
"Starting suggestions handler from [{}, {}, {}].",
config,
suggestionsRepo,
@ -122,7 +123,7 @@ final class SuggestionsHandler(
def initializing(init: SuggestionsHandler.Initialization): Receive = {
case ProjectNameChangedEvent(oldName, newName) =>
log.info(
logger.info(
"Initializing: project name changed from [{}] to [{}].",
oldName,
newName
@ -133,12 +134,12 @@ final class SuggestionsHandler(
.pipeTo(self)
case ProjectNameUpdated(name, updates) =>
log.info("Initializing: project name is updated to [{}].", name)
logger.info("Initializing: project name is updated to [{}].", name)
updates.foreach(sessionRouter ! _)
tryInitialize(init.copy(project = Some(name)))
case InitializedEvent.SuggestionsRepoInitialized =>
log.info("Initializing: suggestions repo initialized.")
logger.info("Initializing: suggestions repo initialized.")
tryInitialize(
init.copy(suggestions =
Some(InitializedEvent.SuggestionsRepoInitialized)
@ -146,14 +147,14 @@ final class SuggestionsHandler(
)
case InitializedEvent.TruffleContextInitialized =>
log.info("Initializing: Truffle context initialized.")
logger.info("Initializing: Truffle context initialized.")
val requestId = UUID.randomUUID()
runtimeConnector
.ask(Api.Request(requestId, Api.GetTypeGraphRequest()))(timeout, self)
.pipeTo(self)
case Api.Response(_, Api.GetTypeGraphResponse(g)) =>
log.info("Initializing: got type graph response.")
logger.info("Initializing: got type graph response.")
tryInitialize(init.copy(typeGraph = Some(g)))
case _ => stash()
@ -164,14 +165,14 @@ final class SuggestionsHandler(
graph: TypeGraph
): Receive = {
case Api.Response(_, Api.VerifyModulesIndexResponse(toRemove)) =>
log.info("Verifying: got verification response.")
logger.info("Verifying: got verification response.")
suggestionsRepo
.removeModules(toRemove)
.map(_ => SuggestionsHandler.Verified)
.pipeTo(self)
case SuggestionsHandler.Verified =>
log.info("Verified.")
logger.info("Verified.")
context.become(initialized(projectName, graph, Set()))
unstashAll()
@ -218,8 +219,7 @@ final class SuggestionsHandler(
}
case Success(None) =>
case Failure(ex) =>
log.error(
ex,
logger.error(
"Error applying suggestion database updates [{}, {}]. {}",
MaskedPath(msg.file.toPath),
msg.version,
@ -228,7 +228,7 @@ final class SuggestionsHandler(
}
case Api.ExpressionUpdates(_, updates) =>
log.debug(
logger.debug(
"Received expression updates [{}].",
updates.map(u => (u.expressionId, u.expressionType))
)
@ -254,8 +254,7 @@ final class SuggestionsHandler(
}
}
case Failure(ex) =>
log.error(
ex,
logger.error(
"Error applying changes from computed values [{}]. {}",
updates.map(_.expressionId),
ex.getMessage
@ -330,13 +329,12 @@ final class SuggestionsHandler(
}
}
case Success(Left(err)) =>
log.error(
logger.error(
s"Error cleaning the index after file delete event [{}].",
err
)
case Failure(ex) =>
log.error(
ex,
logger.error(
"Error cleaning the index after file delete event. {}",
ex.getMessage
)
@ -415,7 +413,7 @@ final class SuggestionsHandler(
private def tryInitialize(state: SuggestionsHandler.Initialization): Unit = {
state.initialized.fold(context.become(initializing(state))) {
case (name, graph) =>
log.debug("Initialized with state [{}].", state)
logger.debug("Initialized with state [{}].", state)
val requestId = UUID.randomUUID()
suggestionsRepo.getAllModules
.flatMap { modules =>
@ -455,11 +453,11 @@ final class SuggestionsHandler(
action match {
case Api.SuggestionAction.Add() =>
if (ids.isEmpty)
log.error("Failed to {} [{}].", verb, suggestion)
logger.error("Failed to {} [{}].", verb, suggestion)
ids.map(id => SuggestionsDatabaseUpdate.Add(id, suggestion))
case Api.SuggestionAction.Remove() =>
if (ids.isEmpty)
log.error(s"Failed to {} [{}].", verb, suggestion)
logger.error(s"Failed to {} [{}].", verb, suggestion)
ids.map(id => SuggestionsDatabaseUpdate.Remove(id))
case m: Api.SuggestionAction.Modify =>
ids.map { id =>

View File

@ -2,7 +2,8 @@ package org.enso.languageserver.search.handler
import java.util.UUID
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
import akka.actor.{Actor, ActorRef, Cancellable, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.languageserver.data.Config
import org.enso.languageserver.requesthandler.RequestTimeout
import org.enso.languageserver.runtime.RuntimeFailureMapper
@ -23,7 +24,7 @@ final class ImportModuleHandler(
timeout: FiniteDuration,
runtime: ActorRef
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher

View File

@ -2,7 +2,8 @@ package org.enso.languageserver.search.handler
import java.util.UUID
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
import akka.actor.{Actor, ActorRef, Cancellable, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.languageserver.data.Config
import org.enso.languageserver.requesthandler.RequestTimeout
import org.enso.languageserver.runtime.RuntimeFailureMapper
@ -23,7 +24,7 @@ final class InvalidateModulesIndexHandler(
timeout: FiniteDuration,
runtime: ActorRef
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher

View File

@ -1,6 +1,7 @@
package org.enso.languageserver.text
import akka.actor.{Actor, ActorLogging, ActorRef, Props, Stash, Terminated}
import akka.actor.{Actor, ActorRef, Props, Stash, Terminated}
import com.typesafe.scalalogging.LazyLogging
import org.enso.languageserver.capability.CapabilityProtocol.{
AcquireCapability,
CapabilityAcquisitionBadRequest,
@ -68,11 +69,11 @@ class BufferRegistry(
versionCalculator: ContentBasedVersioning
) extends Actor
with Stash
with ActorLogging
with LazyLogging
with UnhandledLogging {
override def preStart(): Unit = {
log.info("Starting initialization.")
logger.info("Starting initialization.")
context.system.eventStream
.subscribe(self, InitializedEvent.FileVersionsRepoInitialized.getClass)
}
@ -81,7 +82,7 @@ class BufferRegistry(
private def initializing: Receive = {
case InitializedEvent.FileVersionsRepoInitialized =>
log.info("Initiaized.")
logger.info("Initiaized.")
context.become(running(Map.empty))
unstashAll()

View File

@ -1,8 +1,9 @@
package org.enso.languageserver.text
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props, Stash}
import akka.actor.{Actor, ActorRef, Cancellable, Props, Stash}
import akka.pattern.pipe
import cats.implicits._
import com.typesafe.scalalogging.LazyLogging
import org.enso.languageserver.capability.CapabilityProtocol._
import org.enso.languageserver.data.{CanEdit, CapabilityRegistration, ClientId}
import org.enso.languageserver.event.{
@ -53,7 +54,7 @@ class CollaborativeBuffer(
versionCalculator: ContentBasedVersioning
) extends Actor
with Stash
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher
@ -67,7 +68,11 @@ class CollaborativeBuffer(
private def uninitialized: Receive = { case OpenFile(client, path) =>
context.system.eventStream.publish(BufferOpened(path))
log.info("Buffer opened for [path:{}, client:{}].", path, client.clientId)
logger.info(
"Buffer opened for [path:{}, client:{}].",
path,
client.clientId
)
readFile(client, path)
}

View File

@ -1,10 +1,18 @@
package org.enso.languageserver.util
import akka.actor.{Actor, ActorLogging}
import akka.actor.Actor
import com.typesafe.scalalogging.LazyLogging
import org.enso.loggingservice.LogLevel
trait UnhandledLogging { this: Actor with ActorLogging =>
trait UnhandledLogging extends LazyLogging { this: Actor =>
override def unhandled(message: Any): Unit =
log.warning("Received unknown message: {}", message)
private val akkaLogLevel = LogLevel
.fromString(context.system.settings.LogLevel)
.getOrElse(LogLevel.Error)
override def unhandled(message: Any): Unit = {
if (implicitly[Ordering[LogLevel]].lteq(LogLevel.Warning, akkaLogLevel)) {
logger.warn("Received unknown message: {}", message.getClass)
}
}
}

View File

@ -2,8 +2,9 @@ package org.enso.projectmanager.infrastructure.languageserver
import java.util.UUID
import akka.actor.{Actor, ActorLogging, Cancellable, Props, Scheduler}
import akka.actor.{Actor, Cancellable, Props, Scheduler}
import akka.stream.SubscriptionWithCancelException.StageWasCompleted
import com.typesafe.scalalogging.LazyLogging
import io.circe.parser._
import org.enso.projectmanager.data.Socket
import org.enso.projectmanager.infrastructure.http.WebSocketConnection.{
@ -47,7 +48,7 @@ class HeartbeatSession(
sendConfirmations: Boolean,
quietErrors: Boolean
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher
@ -59,14 +60,14 @@ class HeartbeatSession(
override def preStart(): Unit = {
connection.attachListener(self)
connection.connect()
log.debug("Heartbeat connection initialized [{}].", socket)
logger.debug("Heartbeat connection initialized [{}].", socket)
}
override def receive: Receive = pingStage
private def pingStage: Receive = {
case WebSocketConnected =>
log.debug("Sending ping message to {}.", socket)
logger.debug("Sending ping message to {}.", socket)
connection.send(s"""
|{
| "jsonrpc": "2.0",
@ -102,7 +103,7 @@ class HeartbeatSession(
case Right(id) =>
if (id == requestId.toString) {
log.debug("Received correct pong message from {}.", socket)
logger.debug("Received correct pong message from {}.", socket)
if (sendConfirmations) {
context.parent ! HeartbeatReceived
@ -111,12 +112,12 @@ class HeartbeatSession(
cancellable.cancel()
stop()
} else {
log.warning("Received unknown response {}.", payload)
logger.warn("Received unknown response {}.", payload)
}
}
case HeartbeatTimeout =>
log.debug("Heartbeat timeout detected for {}.", requestId)
logger.debug("Heartbeat timeout detected for {}.", requestId)
context.parent ! ServerUnresponsive
stop()
@ -166,25 +167,25 @@ class HeartbeatSession(
arg: AnyRef
): Unit = {
if (quietErrors) {
log.debug(s"$message ($throwable)", arg)
logger.debug(s"$message ($throwable)", arg)
} else {
log.error(throwable, message, arg)
logger.error(s"$message {}", arg, throwable.getMessage)
}
}
private def logError(throwable: Throwable, message: String): Unit = {
if (quietErrors) {
log.debug(s"$message ($throwable)")
logger.debug(s"$message ($throwable)")
} else {
log.error(throwable, message)
logger.error(message, throwable)
}
}
private def logError(message: String): Unit = {
if (quietErrors) {
log.debug(message)
logger.debug(message)
} else {
log.error(message)
logger.error(message)
}
}

View File

@ -1,6 +1,7 @@
package org.enso.projectmanager.infrastructure.languageserver
import akka.actor.{Actor, ActorLogging, ActorRef, Props}
import akka.actor.{Actor, ActorRef, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.logger.akka.ActorMessageLogging
import org.enso.projectmanager.boot.configuration.BootloaderConfig
import org.enso.projectmanager.infrastructure.languageserver.LanguageServerBootLoader.{
@ -41,7 +42,7 @@ class LanguageServerBootLoader(
bootTimeout: FiniteDuration,
executor: LanguageServerExecutor
) extends Actor
with ActorLogging
with LazyLogging
with ActorMessageLogging
with UnhandledLogging {
@ -52,7 +53,7 @@ class LanguageServerBootLoader(
import context.dispatcher
override def preStart(): Unit = {
log.info("Booting a language server [{}].", descriptor)
logger.info("Booting a language server [{}].", descriptor)
self ! FindFreeSocket
}
@ -65,13 +66,15 @@ class LanguageServerBootLoader(
private def findingSocket(retry: Int = 0): Receive =
LoggingReceive.withLabel("findingSocket") {
case FindFreeSocket =>
log.debug("Looking for available socket to bind the language server.")
logger.debug(
"Looking for available socket to bind the language server."
)
val jsonRpcPort = findPort()
var binaryPort = findPort()
while (binaryPort == jsonRpcPort) {
binaryPort = findPort()
}
log.info(
logger.info(
"Found sockets for the language server " +
"[json:{}:{}, binary:{}:{}].",
descriptor.networkConfig.interface,
@ -126,7 +129,7 @@ class LanguageServerBootLoader(
bootRequester: ActorRef
): Receive = {
case Boot =>
log.debug("Booting a language server.")
logger.debug("Booting a language server.")
context.actorOf(
LanguageServerProcess.props(
progressTracker = bootProgressTracker,
@ -164,7 +167,7 @@ class LanguageServerBootLoader(
rpcPort = rpcPort,
dataPort = dataPort
)
log.info("Language server booted [{}].", connectionInfo)
logger.info("Language server booted [{}].", connectionInfo)
bootRequester ! ServerBooted(connectionInfo, self)
context.become(running(connectionInfo))
@ -182,7 +185,7 @@ class LanguageServerBootLoader(
private def running(connectionInfo: LanguageServerConnectionInfo): Receive =
LoggingReceive.withLabel("running") {
case msg @ LanguageServerProcess.ServerTerminated(exitCode) =>
log.debug(
logger.debug(
"Language Server process has terminated with exit code {}.",
exitCode
)
@ -213,7 +216,7 @@ class LanguageServerBootLoader(
): Receive =
LoggingReceive.withLabel("restartingWaitingForShutdown") {
case LanguageServerProcess.ServerTerminated(exitCode) =>
log.debug(
logger.debug(
"Language Server process has terminated (as requested to reboot) " +
"with exit code {}.",
exitCode
@ -256,7 +259,7 @@ class LanguageServerBootLoader(
message: String,
throwable: Option[Throwable]
): Unit = {
log.warning(message)
logger.warn(message)
if (shouldRetry && retryCount < config.numberOfRetries) {
context.system.scheduler
@ -264,12 +267,12 @@ class LanguageServerBootLoader(
context.become(findingSocket(retryCount + 1))
} else {
if (shouldRetry) {
log.error(
logger.error(
"Tried {} times to boot Language Server. Giving up.",
retryCount
)
} else {
log.error("Failed to restart the server. Giving up.")
logger.error("Failed to restart the server. Giving up.")
}
bootRequester ! ServerBootFailed(
throwable.getOrElse(new RuntimeException(message))

View File

@ -4,7 +4,6 @@ import java.util.UUID
import akka.actor.{
Actor,
ActorLogging,
ActorRef,
Cancellable,
OneForOneStrategy,
@ -13,6 +12,7 @@ import akka.actor.{
SupervisorStrategy,
Terminated
}
import com.typesafe.scalalogging.LazyLogging
import nl.gn0s1s.bump.SemVer
import org.enso.logger.akka.ActorMessageLogging
import org.enso.projectmanager.boot.configuration.{
@ -65,7 +65,7 @@ class LanguageServerController(
loggingServiceDescriptor: LoggingServiceDescriptor,
executor: LanguageServerExecutor
) extends Actor
with ActorLogging
with LazyLogging
with ActorMessageLogging
with Stash
with UnhandledLogging {
@ -119,12 +119,12 @@ class LanguageServerController(
private def booting(Bootloader: ActorRef): Receive =
LoggingReceive.withLabel("booting") {
case BootTimeout =>
log.error("Booting failed for {}.", descriptor)
logger.error("Booting failed for {}.", descriptor)
unstashAll()
context.become(bootFailed(LanguageServerProtocol.ServerBootTimedOut))
case ServerBootFailed(th) =>
log.error(th, "Booting failed for {}.", descriptor)
logger.error("Booting failed for {}. {}", descriptor, th.getMessage)
unstashAll()
context.become(bootFailed(LanguageServerProtocol.ServerBootFailed(th)))
@ -143,7 +143,7 @@ class LanguageServerController(
)
case Terminated(Bootloader) =>
log.error("Bootloader for project {} failed.", project.name)
logger.error("Bootloader for project {} failed.", project.name)
unstashAll()
context.become(
bootFailed(
@ -188,7 +188,7 @@ class LanguageServerController(
)
}
case Terminated(_) =>
log.debug("Bootloader for {} terminated.", project)
logger.debug("Bootloader for {} terminated.", project)
case StopServer(clientId, _) =>
removeClient(
@ -228,7 +228,7 @@ class LanguageServerController(
)
case ServerDied =>
log.error("Language server died [{}].", connectionInfo)
logger.error("Language server died [{}].", connectionInfo)
context.stop(self)
}
@ -252,7 +252,7 @@ class LanguageServerController(
}
private def shutDownServer(maybeRequester: Option[ActorRef]): Unit = {
log.debug("Shutting down a language server for project {}.", project.id)
logger.debug("Shutting down a language server for project {}.", project.id)
context.children.foreach(_ ! GracefulStop)
val cancellable =
context.system.scheduler
@ -274,9 +274,9 @@ class LanguageServerController(
case LanguageServerProcess.ServerTerminated(exitCode) =>
cancellable.cancel()
if (exitCode == 0) {
log.info("Language server shut down successfully [{}].", project)
logger.info("Language server shut down successfully [{}].", project)
} else {
log.warning(
logger.warn(
"Language server shut down with non-zero exit code: {} [{}].",
exitCode,
project
@ -286,7 +286,7 @@ class LanguageServerController(
stop()
case ShutdownTimeout =>
log.error("Language server shutdown timed out.")
logger.error("Language server shutdown timed out.")
maybeRequester.foreach(_ ! ServerShutdownTimedOut)
stop()

View File

@ -1,14 +1,7 @@
package org.enso.projectmanager.infrastructure.languageserver
import akka.actor.{
Actor,
ActorLogging,
ActorRef,
Cancellable,
PoisonPill,
Props,
Terminated
}
import akka.actor.{Actor, ActorRef, Cancellable, PoisonPill, Props, Terminated}
import com.typesafe.scalalogging.LazyLogging
import org.enso.projectmanager.infrastructure.languageserver.LanguageServerController.ShutDownServer
import org.enso.projectmanager.infrastructure.languageserver.LanguageServerKiller.KillTimeout
import org.enso.projectmanager.infrastructure.languageserver.LanguageServerProtocol.{
@ -30,7 +23,7 @@ class LanguageServerKiller(
controllers: List[ActorRef],
shutdownTimeout: FiniteDuration
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher
@ -40,7 +33,7 @@ class LanguageServerKiller(
sender() ! AllServersKilled
context.stop(self)
} else {
log.info("Killing all servers [{}].", controllers)
logger.info("Killing all servers [{}].", controllers)
controllers.foreach(context.watch)
controllers.foreach(_ ! ShutDownServer)
val cancellable =
@ -61,7 +54,7 @@ class LanguageServerKiller(
case Terminated(dead) =>
val updated = liveControllers - dead
if (updated.isEmpty) {
log.info("All language servers have been killed.")
logger.info("All language servers have been killed.")
cancellable.cancel()
replyTo ! AllServersKilled
context.stop(self)

View File

@ -2,7 +2,8 @@ package org.enso.projectmanager.infrastructure.languageserver
import java.util.UUID
import akka.actor.{Actor, ActorLogging, ActorRef, Props, Terminated}
import akka.actor.{Actor, ActorRef, Props, Terminated}
import com.typesafe.scalalogging.LazyLogging
import org.enso.projectmanager.boot.configuration.{
BootloaderConfig,
NetworkConfig,
@ -48,7 +49,7 @@ class LanguageServerRegistry(
loggingServiceDescriptor: LoggingServiceDescriptor,
executor: LanguageServerExecutor
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
override def receive: Receive = running()

View File

@ -2,15 +2,8 @@ package org.enso.projectmanager.infrastructure.languageserver
import java.util.UUID
import akka.actor.{
Actor,
ActorLogging,
ActorRef,
Cancellable,
Props,
Scheduler,
Terminated
}
import akka.actor.{Actor, ActorRef, Cancellable, Props, Scheduler, Terminated}
import com.typesafe.scalalogging.LazyLogging
import org.enso.projectmanager.boot.configuration.SupervisionConfig
import org.enso.projectmanager.data.Socket
import org.enso.projectmanager.infrastructure.http.WebSocketConnectionFactory
@ -44,7 +37,7 @@ class LanguageServerSupervisor(
connectionFactory: WebSocketConnectionFactory,
scheduler: Scheduler
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher
@ -83,7 +76,7 @@ class LanguageServerSupervisor(
case ServerUnresponsive =>
cancellable.cancel()
log.info("Server is unresponsive. Restarting [{}].", connectionInfo)
logger.info("Server is unresponsive. Restarting [{}].", connectionInfo)
serverProcessManager ! Restart
context.become(restarting)
@ -94,18 +87,18 @@ class LanguageServerSupervisor(
private def restarting: Receive = {
case ServerBootFailed(_) =>
log.error("Cannot restart language server.")
logger.error("Cannot restart language server.")
context.parent ! ServerDied
context.stop(self)
case ServerBooted(_, newProcessManager) =>
if (newProcessManager != serverProcessManager) {
log.error(
logger.error(
"The process manager actor has changed. This should never happen. " +
"Supervisor may no longer work correctly."
)
}
log.info("Language server restarted [{}].", connectionInfo)
logger.info("Language server restarted [{}].", connectionInfo)
val cancellable =
scheduler.scheduleAtFixedRate(
supervisionConfig.initialDelay,

View File

@ -2,8 +2,9 @@ package org.enso.projectmanager.infrastructure.languageserver
import java.util.UUID
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props, Scheduler}
import akka.actor.{Actor, ActorRef, Cancellable, Props, Scheduler}
import akka.stream.SubscriptionWithCancelException.StageWasCompleted
import com.typesafe.scalalogging.LazyLogging
import io.circe
import io.circe.Json
import io.circe.parser.parse
@ -50,7 +51,7 @@ class ProjectRenameAction(
newName: String,
scheduler: Scheduler
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.{dispatcher, system}
@ -64,7 +65,7 @@ class ProjectRenameAction(
private var maybeActionTimeoutCancellable: Option[Cancellable] = None
override def preStart(): Unit = {
log.info("Requesting a Language Server to rename project [{}].", oldName)
logger.info("Requesting a Language Server to rename project [{}].", oldName)
connection.attachListener(self)
connection.connect()
val cancellable =
@ -92,21 +93,22 @@ class ProjectRenameAction(
context.become(connected())
case WebSocketStreamFailure(th) =>
log.error(
th,
"An error occurred during connecting to websocket {}.",
socket
logger.error(
s"An error occurred during connecting to websocket $socket.",
th
)
replyTo ! CannotConnectToServer
stop()
case ActionTimeout =>
log.error("Action timeout occurred. Stopping actor.")
logger.error("Action timeout occurred. Stopping actor.")
replyTo ! RenameTimeout
stop()
case GracefulStop =>
log.warning("Ignoring stop command (Language Server is not connected).")
logger.warn(
"Ignoring stop command (Language Server is not connected)."
)
}
private def connected(): Receive = {
@ -126,17 +128,17 @@ class ProjectRenameAction(
maybeActionTimeoutCancellable.foreach(_.cancel())
case WebSocketStreamFailure(th) =>
log.error(th, "An error occurred during waiting for Pong message.")
logger.error("An error occurred during waiting for Pong message.", th)
replyTo ! ServerUnresponsive
stop()
case ActionTimeout =>
log.error("Action timeout occurred. Stopping actor.")
logger.error("Action timeout occurred. Stopping actor.")
replyTo ! RenameTimeout
stop()
case GracefulStop =>
log.warning("Ignoring stop command (Language Server is connected).")
logger.warn("Ignoring stop command (Language Server is connected).")
}
private def handleSuccess(payload: String): Unit = {
@ -145,15 +147,15 @@ class ProjectRenameAction(
maybeRequestId match {
case Left(error) =>
log.error(error, "An error occurred during parsing rename reply.")
logger.error("An error occurred during parsing rename reply.", error)
case Right(id) =>
if (id == requestId.toString) {
log.info("Project renamed by the Language Server.")
logger.info("Project renamed by the Language Server.")
replyTo ! ProjectRenamed
stop()
} else {
log.warning("Received unknown response [{}].", payload)
logger.warn("Received unknown response [{}].", payload)
}
}
}
@ -164,7 +166,7 @@ class ProjectRenameAction(
val msg = maybeError
.flatMap(_.hcursor.downField("message").as[String])
.getOrElse("Not Provided")
log.error(
logger.error(
"Error occurred during renaming project [code: {}, message: {}]",
code,
msg
@ -181,16 +183,16 @@ class ProjectRenameAction(
closureTimeoutCancellable.cancel()
case WebSocketStreamFailure(th) =>
log.error(th, "An error occurred during closing web socket.")
logger.error("An error occurred during closing web socket.", th)
context.stop(self)
closureTimeoutCancellable.cancel()
case SocketClosureTimeout =>
log.error("Socket closure timed out.")
logger.error("Socket closure timed out.")
context.stop(self)
case GracefulStop =>
log.warning(
logger.warn(
"Ignoring stop command (closing connection to Language Server)."
)
}

View File

@ -1,6 +1,7 @@
package org.enso.projectmanager.infrastructure.languageserver
import akka.actor.{Actor, ActorLogging, ActorRef, Props}
import akka.actor.{Actor, ActorRef, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.projectmanager.infrastructure.languageserver.ShutdownHookActivator.ArePendingShutdownHooks
import org.enso.projectmanager.infrastructure.languageserver.ShutdownHookActivationWatcher.{
AllShutdownHooksFired,
@ -8,6 +9,7 @@ import org.enso.projectmanager.infrastructure.languageserver.ShutdownHookActivat
Watch
}
import org.enso.projectmanager.util.UnhandledLogging
import scala.concurrent.duration._
/** An actor that waits until all shutdown hooks will be fired.
@ -16,7 +18,7 @@ import scala.concurrent.duration._
*/
class ShutdownHookActivationWatcher(shutdownHookActivator: ActorRef)
extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher

View File

@ -2,7 +2,8 @@ package org.enso.projectmanager.infrastructure.languageserver
import java.util.UUID
import akka.actor.{Actor, ActorLogging, Props}
import akka.actor.{Actor, Props}
import com.typesafe.scalalogging.LazyLogging
import org.enso.projectmanager.control.core.CovariantFlatMap
import org.enso.projectmanager.control.effect.Exec
import org.enso.projectmanager.event.ProjectEvent.ProjectClosed
@ -19,7 +20,7 @@ import org.enso.projectmanager.util.UnhandledLogging
*/
class ShutdownHookActivator[F[+_, +_]: Exec: CovariantFlatMap]
extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
override def preStart(): Unit = {

View File

@ -2,8 +2,9 @@ package org.enso.projectmanager.infrastructure.languageserver
import java.util.UUID
import akka.actor.{Actor, ActorLogging, Props, Status}
import akka.actor.{Actor, Props, Status}
import akka.pattern.pipe
import com.typesafe.scalalogging.LazyLogging
import org.enso.projectmanager.control.core.CovariantFlatMap
import org.enso.projectmanager.control.core.syntax._
import org.enso.projectmanager.control.effect.Exec
@ -20,7 +21,7 @@ class ShutdownHookRunner[F[+_, +_]: Exec: CovariantFlatMap](
projectId: UUID,
hooks: List[ShutdownHook[F]]
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
import context.dispatcher
@ -30,22 +31,21 @@ class ShutdownHookRunner[F[+_, +_]: Exec: CovariantFlatMap](
}
override def receive: Receive = { case Run =>
log.info("Firing shutdown hooks for project [{}].", projectId)
logger.info("Firing shutdown hooks for project [{}].", projectId)
Exec[F].exec { traverse(hooks) { _.execute() } } pipeTo self
context.become(running)
}
private def running: Receive = {
case Status.Failure(th) =>
log.error(
th,
"An error occurred during running shutdown hooks for project [{}].",
projectId
logger.error(
s"An error occurred during running shutdown hooks for project [$projectId].",
th
)
context.stop(self)
case Right(_) =>
log.info("All shutdown hooks fired for project [{}].", projectId)
logger.info("All shutdown hooks fired for project [{}].", projectId)
context.stop(self)
}

View File

@ -2,7 +2,8 @@ package org.enso.projectmanager.protocol
import java.util.UUID
import akka.actor.{Actor, ActorLogging, ActorRef, Props, Stash}
import akka.actor.{Actor, ActorRef, Props, Stash}
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc.{JsonRpcServer, MessageHandler, Method, Request}
import org.enso.projectmanager.boot.configuration.TimeoutConfig
import org.enso.projectmanager.control.core.CovariantFlatMap
@ -42,7 +43,7 @@ class ClientController[F[+_, +_]: Exec: CovariantFlatMap: ErrorChannel](
loggingServiceDescriptor: LoggingServiceDescriptor,
timeoutConfig: TimeoutConfig
) extends Actor
with ActorLogging
with LazyLogging
with Stash
with UnhandledLogging {
@ -100,7 +101,7 @@ class ClientController[F[+_, +_]: Exec: CovariantFlatMap: ErrorChannel](
override def receive: Receive = {
case JsonRpcServer.WebConnect(webActor) =>
log.info("Client connected to Project Manager [{}]", clientId)
logger.info("Client connected to Project Manager [{}]", clientId)
unstashAll()
context.become(connected(webActor))
context.system.eventStream.publish(ClientConnected(clientId))
@ -110,7 +111,7 @@ class ClientController[F[+_, +_]: Exec: CovariantFlatMap: ErrorChannel](
def connected(@unused webActor: ActorRef): Receive = {
case MessageHandler.Disconnected =>
log.info("Client disconnected from the Project Manager [{}]", clientId)
logger.info("Client disconnected from the Project Manager [{}]", clientId)
context.system.eventStream.publish(ClientDisconnected(clientId))
context.stop(self)

View File

@ -1,8 +1,9 @@
package org.enso.projectmanager.requesthandler
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props, Status}
import akka.actor.{Actor, ActorRef, Cancellable, Props, Status}
import akka.http.scaladsl.model.Uri
import akka.pattern.pipe
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc.{Id, Request, ResponseError, ResponseResult}
import org.enso.projectmanager.protocol.ProjectManagementApi.{
LoggingServiceGetEndpoint,
@ -22,7 +23,7 @@ class LoggingServiceEndpointRequestHandler(
loggingServiceDescriptor: LoggingServiceDescriptor,
requestTimeout: FiniteDuration
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
private def method = LoggingServiceGetEndpoint
@ -51,7 +52,7 @@ class LoggingServiceEndpointRequestHandler(
timeoutCancellable: Cancellable
): Receive = {
case Status.Failure(ex) =>
log.error(ex, "Failure during {} operation.", method)
logger.error(s"Failure during $method operation.", ex)
replyTo ! ResponseError(
Some(id),
LoggingServiceUnavailable(s"Logging service failed to set up: $ex")
@ -60,7 +61,7 @@ class LoggingServiceEndpointRequestHandler(
context.stop(self)
case RequestTimeout =>
log.error("Request {} with {} timed out.", method, id)
logger.error("Request {} with {} timed out.", method, id)
replyTo ! ResponseError(
Some(id),
LoggingServiceUnavailable(

View File

@ -2,8 +2,9 @@ package org.enso.projectmanager.requesthandler
import java.util.UUID
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props, Status}
import akka.actor.{Actor, ActorRef, Cancellable, Props, Status}
import akka.pattern.pipe
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc.Errors.ServiceError
import org.enso.jsonrpc._
import org.enso.projectmanager.control.effect.Exec
@ -28,7 +29,7 @@ class ProjectCloseHandler[F[+_, +_]: Exec](
service: ProjectServiceApi[F],
requestTimeout: FiniteDuration
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
override def receive: Receive = requestStage
@ -51,18 +52,18 @@ class ProjectCloseHandler[F[+_, +_]: Exec](
cancellable: Cancellable
): Receive = {
case Status.Failure(ex) =>
log.error(ex, "Failure during {} operation.", ProjectClose)
logger.error("Failure during ProjectClose operation.", ex)
replyTo ! ResponseError(Some(id), ServiceError)
cancellable.cancel()
context.stop(self)
case RequestTimeout =>
log.error("Request {} with {} timed out.", ProjectClose, id)
logger.error("Request {} with {} timed out.", ProjectClose, id)
replyTo ! ResponseError(Some(id), ServiceError)
context.stop(self)
case Left(failure: ProjectServiceFailure) =>
log.error("Request {} failed due to {}.", id, failure)
logger.error("Request {} failed due to {}.", id, failure)
replyTo ! ResponseError(Some(id), mapFailure(failure))
cancellable.cancel()
context.stop(self)

View File

@ -2,6 +2,7 @@ package org.enso.projectmanager.requesthandler
import akka.actor._
import akka.pattern.pipe
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc.Errors.ServiceError
import org.enso.jsonrpc._
import org.enso.projectmanager.control.effect.Exec
@ -24,7 +25,7 @@ class ProjectDeleteHandler[F[+_, +_]: Exec](
service: ProjectServiceApi[F],
requestTimeout: FiniteDuration
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
override def receive: Receive = requestStage
@ -45,18 +46,18 @@ class ProjectDeleteHandler[F[+_, +_]: Exec](
cancellable: Cancellable
): Receive = {
case Status.Failure(ex) =>
log.error(ex, "Failure during {} operation.", ProjectDelete)
logger.error("Failure during ProjectDelete operation.", ex)
replyTo ! ResponseError(Some(id), ServiceError)
cancellable.cancel()
context.stop(self)
case RequestTimeout =>
log.error("Request {} with {} timed out.", ProjectDelete, id)
logger.error("Request {} with {} timed out.", ProjectDelete, id)
replyTo ! ResponseError(Some(id), ServiceError)
context.stop(self)
case Left(failure: ProjectServiceFailure) =>
log.error("Request {} failed due to {}.", id, failure)
logger.error("Request {} failed due to {}.", id, failure)
replyTo ! ResponseError(Some(id), mapFailure(failure))
cancellable.cancel()
context.stop(self)

View File

@ -2,8 +2,9 @@ package org.enso.projectmanager.requesthandler
import java.util.UUID
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props, Status}
import akka.actor.{Actor, ActorRef, Cancellable, Props, Status}
import akka.pattern.pipe
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc.Errors.ServiceError
import org.enso.jsonrpc.{Id, Request, ResponseError, ResponseResult}
import org.enso.projectmanager.control.effect.Exec
@ -30,7 +31,7 @@ class ProjectListHandler[F[+_, +_]: Exec](
service: ProjectServiceApi[F],
requestTimeout: FiniteDuration
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
override def receive: Receive = requestStage
@ -54,18 +55,18 @@ class ProjectListHandler[F[+_, +_]: Exec](
cancellable: Cancellable
): Receive = {
case Status.Failure(ex) =>
log.error(ex, "Failure during {} operation.", ProjectList)
logger.error("Failure during ProjectList operation.", ex)
replyTo ! ResponseError(Some(id), ServiceError)
cancellable.cancel()
context.stop(self)
case RequestTimeout =>
log.error("Request {} with {} timed out.", ProjectList, id)
logger.error("Request {} with {} timed out.", ProjectList, id)
replyTo ! ResponseError(Some(id), ServiceError)
context.stop(self)
case Left(failure: ProjectServiceFailure) =>
log.error("Request {} failed due to {}.", id, failure)
logger.error("Request {} failed due to {}.", id, failure)
replyTo ! ResponseError(Some(id), mapFailure(failure))
cancellable.cancel()
context.stop(self)

View File

@ -1,7 +1,8 @@
package org.enso.projectmanager.requesthandler
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props, Status}
import akka.actor.{Actor, ActorRef, Cancellable, Props, Status}
import akka.pattern.pipe
import com.typesafe.scalalogging.LazyLogging
import org.enso.jsonrpc.Errors.ServiceError
import org.enso.jsonrpc._
import org.enso.projectmanager.control.effect.Exec
@ -24,7 +25,7 @@ class ProjectRenameHandler[F[+_, +_]: Exec](
service: ProjectServiceApi[F],
requestTimeout: FiniteDuration
) extends Actor
with ActorLogging
with LazyLogging
with UnhandledLogging {
override def receive: Receive = requestStage
@ -48,18 +49,18 @@ class ProjectRenameHandler[F[+_, +_]: Exec](
cancellable: Cancellable
): Receive = {
case Status.Failure(ex) =>
log.error(ex, "Failure during {} operation.", ProjectRename)
logger.error("Failure during ProjectRename operation.", ex)
replyTo ! ResponseError(Some(id), ServiceError)
cancellable.cancel()
context.stop(self)
case RequestTimeout =>
log.error("Request {} with {} timed out.", ProjectRename, id)
logger.error("Request {} with {} timed out.", ProjectRename, id)
replyTo ! ResponseError(Some(id), ServiceError)
context.stop(self)
case Left(failure: ProjectServiceFailure) =>
log.error(s"Request {} failed due to {}.", id, failure)
logger.error(s"Request {} failed due to {}.", id, failure)
replyTo ! ResponseError(Some(id), mapFailure(failure))
cancellable.cancel()
context.stop(self)

View File

@ -1,8 +1,8 @@
package org.enso.projectmanager.requesthandler
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Stash, Status}
import akka.actor.{Actor, ActorRef, Cancellable, Stash, Status}
import akka.pattern.pipe
import com.typesafe.scalalogging.Logger
import com.typesafe.scalalogging.{LazyLogging, Logger}
import org.enso.jsonrpc.Errors.ServiceError
import org.enso.jsonrpc.{
HasParams,
@ -46,7 +46,7 @@ abstract class RequestHandler[
@unused evParams: HasParams.Aux[M, Params],
@unused evResult: HasResult.Aux[M, Result]
) extends Actor
with ActorLogging
with LazyLogging
with Stash
with UnhandledLogging {
override def receive: Receive = requestStage
@ -90,18 +90,18 @@ abstract class RequestHandler[
timeoutCancellable: Option[Cancellable]
): Receive = {
case Status.Failure(ex) =>
log.error(ex, "Failure during {} operation.", method)
logger.error(s"Failure during $method operation.", ex)
replyTo ! ResponseError(Some(id), ServiceError)
timeoutCancellable.foreach(_.cancel())
context.stop(self)
case RequestTimeout =>
log.error("Request {} with {} timed out.", method, id)
logger.error("Request {} with {} timed out.", method, id)
replyTo ! ResponseError(Some(id), ServiceError)
context.stop(self)
case Left(failure: FailureType) =>
log.error("Request {} with {} failed due to {}.", method, id, failure)
logger.error("Request {} with {} failed due to {}.", method, id, failure)
val error = implicitly[FailureMapper[FailureType]].mapFailure(failure)
replyTo ! ResponseError(Some(id), error)
timeoutCancellable.foreach(_.cancel())

View File

@ -1,10 +1,19 @@
package org.enso.projectmanager.util
import akka.actor.{Actor, ActorLogging}
import akka.actor.Actor
import com.typesafe.scalalogging.LazyLogging
import org.enso.loggingservice.LogLevel
trait UnhandledLogging { this: Actor with ActorLogging =>
trait UnhandledLogging extends LazyLogging { this: Actor =>
override def unhandled(message: Any): Unit =
log.warning("Received unknown message: {}", message)
private val akkaLogLevel = LogLevel
.fromString(context.system.settings.LogLevel)
.getOrElse(LogLevel.Error)
override def unhandled(message: Any): Unit = {
if (implicitly[Ordering[LogLevel]].lteq(LogLevel.Warning, akkaLogLevel)) {
logger.warn("Received unknown message: {}", message.getClass)
}
}
}