Skip to content

Commit 28ff50a

Browse files
committed
to get rid of StrictLogging
1 parent c27ffc0 commit 28ff50a

23 files changed

+76
-47
lines changed

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ ThisBuild / organization := "app.softnetwork"
22

33
name := "notification"
44

5-
ThisBuild / version := "0.6.3"
5+
ThisBuild / version := "0.6.4"
66

77
ThisBuild / scalaVersion := "2.12.18"
88

common/src/main/scala/app/softnetwork/notification/config/NotificationSettings.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
package app.softnetwork.notification.config
22

3-
import com.typesafe.scalalogging.StrictLogging
43
import configs.Configs
54

65
import scala.language.{implicitConversions, reflectiveCalls}
76

8-
trait NotificationSettings extends StrictLogging { _: InternalConfig =>
7+
trait NotificationSettings { _: InternalConfig =>
98
lazy val NotificationConfig: NotificationConfig =
109
Configs[NotificationConfig].get(config, "notification").toEither match {
1110
case Left(configError) =>
12-
logger.error(s"Something went wrong with the provided arguments $configError")
11+
Console.err.println(s"Something went wrong with the provided arguments $configError")
1312
throw configError.configException
1413
case Right(r) => r
1514
}

core/src/main/scala/app/softnetwork/notification/config/MailSettings.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ trait MailSettings extends NotificationSettings { _: InternalConfig =>
99
lazy val MailConfig: MailConfig =
1010
Configs[MailConfig].get(config, "notification.mail").toEither match {
1111
case Left(configError) =>
12-
logger.error(s"Something went wrong with the provided arguments $configError")
12+
Console.err.println(s"Something went wrong with the provided arguments $configError")
1313
throw configError.configException
1414
case Right(r) => r
1515
}

core/src/main/scala/app/softnetwork/notification/config/PushSettings.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ trait PushSettings extends NotificationSettings { _: InternalConfig =>
1010
lazy val DefaultConfig: PushConfig =
1111
Configs[PushConfig].get(config, "notification.push").toEither match {
1212
case Left(configError) =>
13-
logger.error(s"Something went wrong with the provided arguments $configError")
13+
Console.err.println(s"Something went wrong with the provided arguments $configError")
1414
throw configError.configException
1515
case Right(r) => r
1616
}

core/src/main/scala/app/softnetwork/notification/config/SMSSettings.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ trait SMSSettings extends NotificationSettings { _: InternalConfig =>
99
lazy val SMSConfig: SMSConfig =
1010
Configs[SMSConfig].get(config, "notification.sms").toEither match {
1111
case Left(configError) =>
12-
logger.error(s"Something went wrong with the provided arguments $configError")
12+
Console.err.println(s"Something went wrong with the provided arguments $configError")
1313
throw configError.configException
1414
case Right(r) => r
1515
}

core/src/main/scala/app/softnetwork/notification/launch/NotificationGuardian.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@ import app.softnetwork.notification.persistence.typed.NotificationBehavior
1313
import app.softnetwork.persistence.launch.{PersistenceGuardian, PersistentEntity}
1414
import app.softnetwork.persistence.query.EventProcessorStream
1515
import app.softnetwork.persistence.schema.SchemaProvider
16-
import com.typesafe.scalalogging.StrictLogging
1716

1817
import scala.language.implicitConversions
1918

20-
trait NotificationGuardian[T <: Notification] extends PersistenceGuardian with StrictLogging {
19+
trait NotificationGuardian[T <: Notification] extends PersistenceGuardian {
2120
_: SchemaProvider =>
2221

2322
import app.softnetwork.persistence.launch.PersistenceGuardian._

core/src/main/scala/app/softnetwork/notification/persistence/typed/AllNotificationsBehavior.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@ package app.softnetwork.notification.persistence.typed
33
import app.softnetwork.notification.config.{DefaultConfig, InternalConfig}
44
import app.softnetwork.notification.model.Notification
55
import app.softnetwork.notification.spi.DefaultMailAndSMSAndFcmAndIosProvider
6+
import org.slf4j.{Logger, LoggerFactory}
67

78
trait AllNotificationsBehavior
89
extends NotificationBehavior[Notification]
910
with DefaultMailAndSMSAndFcmAndIosProvider { _: InternalConfig =>
1011
override val persistenceId = "Notification"
1112
}
1213

13-
object AllNotificationsBehavior extends AllNotificationsBehavior with DefaultConfig
14+
object AllNotificationsBehavior extends AllNotificationsBehavior with DefaultConfig {
15+
override def log: Logger = LoggerFactory.getLogger(this.getClass)
16+
}

core/src/main/scala/app/softnetwork/notification/persistence/typed/MailNotificationsBehavior.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import akka.actor.typed.ActorSystem
44
import app.softnetwork.notification.config.{DefaultConfig, InternalConfig}
55
import app.softnetwork.notification.spi.{MailProvider, SimpleMailProvider}
66
import app.softnetwork.notification.model.{Mail, NotificationAck}
7+
import org.slf4j.{Logger, LoggerFactory}
78

89
trait MailNotificationsBehavior extends NotificationBehavior[Mail] { _: MailProvider =>
910
override def persistenceId: String = "MailNotification"
@@ -20,4 +21,6 @@ trait SimpleMailNotificationsBehavior extends MailNotificationsBehavior with Sim
2021
_: InternalConfig =>
2122
}
2223

23-
object SimpleMailNotificationsBehavior extends SimpleMailNotificationsBehavior with DefaultConfig
24+
object SimpleMailNotificationsBehavior extends SimpleMailNotificationsBehavior with DefaultConfig {
25+
override def log: Logger = LoggerFactory.getLogger(this.getClass)
26+
}

core/src/main/scala/app/softnetwork/notification/persistence/typed/PushNotificationsBehavior.scala

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import app.softnetwork.notification.spi.{
1212
PushProvider
1313
}
1414
import app.softnetwork.notification.model.{NotificationAck, Push}
15+
import org.slf4j.{Logger, LoggerFactory}
1516

1617
trait PushNotificationsBehavior extends NotificationBehavior[Push] { _: PushProvider =>
1718
override def send(notification: Push)(implicit system: ActorSystem[_]): NotificationAck =
@@ -30,7 +31,9 @@ trait FcmNotificationsBehavior extends AndroidNotificationsBehavior with FcmProv
3031
_: InternalConfig =>
3132
}
3233

33-
object FcmNotificationsBehavior extends FcmNotificationsBehavior with DefaultConfig
34+
object FcmNotificationsBehavior extends FcmNotificationsBehavior with DefaultConfig {
35+
override def log: Logger = LoggerFactory.getLogger(this.getClass)
36+
}
3437

3538
trait IosNotificationsBehavior extends PushNotificationsBehavior { _: IosProvider =>
3639
override def persistenceId: String = "IosNotification"
@@ -40,7 +43,9 @@ trait ApnsNotificationsBehavior extends IosNotificationsBehavior with ApnsProvid
4043
_: InternalConfig =>
4144
}
4245

43-
object ApnsNotificationsBehavior extends ApnsNotificationsBehavior with DefaultConfig
46+
object ApnsNotificationsBehavior extends ApnsNotificationsBehavior with DefaultConfig {
47+
override def log: Logger = LoggerFactory.getLogger(this.getClass)
48+
}
4449

4550
trait AndroidAndIosNotificationsBehavior extends PushNotificationsBehavior {
4651
_: AndroidAndIosProvider =>
@@ -51,4 +56,6 @@ trait FcmAndApnsNotificationsBehavior
5156
extends AndroidAndIosNotificationsBehavior
5257
with FcmAndApnsProvider { _: InternalConfig => }
5358

54-
object FcmAndApnsNotificationsBehavior extends FcmAndApnsNotificationsBehavior with DefaultConfig
59+
object FcmAndApnsNotificationsBehavior extends FcmAndApnsNotificationsBehavior with DefaultConfig {
60+
override def log: Logger = LoggerFactory.getLogger(this.getClass)
61+
}

core/src/main/scala/app/softnetwork/notification/persistence/typed/SMSNotificationsBehavior.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import akka.actor.typed.ActorSystem
44
import app.softnetwork.notification.config.{DefaultConfig, InternalConfig}
55
import app.softnetwork.notification.spi.{SMSModeProvider, SMSProvider}
66
import app.softnetwork.notification.model.{NotificationAck, SMS}
7+
import org.slf4j.{Logger, LoggerFactory}
78

89
trait SMSNotificationsBehavior extends NotificationBehavior[SMS] { _: SMSProvider =>
910
override def persistenceId: String = "SMSNotification"
@@ -21,4 +22,6 @@ trait SMSModeNotificationsBehavior extends SMSNotificationsBehavior with SMSMode
2122
_: InternalConfig =>
2223
}
2324

24-
object SMSModeNotificationsBehavior extends SMSModeNotificationsBehavior with DefaultConfig
25+
object SMSModeNotificationsBehavior extends SMSModeNotificationsBehavior with DefaultConfig {
26+
override def log: Logger = LoggerFactory.getLogger(this.getClass)
27+
}

0 commit comments

Comments
 (0)