Skip to content

Commit 1b34000

Browse files
Merge pull request #890 from morgen-peschke/normalize-wildcards
Fix some warnings related to -xsource:3
2 parents a806f03 + 4d26ee3 commit 1b34000

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+121
-112
lines changed

README.md

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Good news, you don't have to! Enter log4cats! Read on!
4141
import org.typelevel.log4cats.Logger
4242
import org.typelevel.log4cats.slf4j.Slf4jLogger
4343
import cats.effect.Sync
44-
import cats.implicits._
44+
import cats.syntax.all.*
4545

4646
object MyThing {
4747
// Impure But What 90% of Folks I know do with log4s
@@ -50,24 +50,24 @@ object MyThing {
5050
// Arbitrary Local Function Declaration
5151
def doSomething[F[_]: Sync]: F[Unit] =
5252
Logger[F].info("Logging Start Something") *>
53-
Sync[F].delay(println("I could be doing anything"))
54-
.attempt.flatMap{
55-
case Left(e) => Logger[F].error(e)("Something Went Wrong")
56-
case Right(_) => Sync[F].pure(())
57-
}
53+
Sync[F].delay(println("I could be doing anything"))
54+
.attempt.flatMap {
55+
case Left(e) => Logger[F].error(e)("Something Went Wrong")
56+
case Right(_) => Sync[F].pure(())
57+
}
5858

5959
def safelyDoThings[F[_]: Sync]: F[Unit] = for {
6060
logger <- Slf4jLogger.create[F]
6161
_ <- logger.info("Logging at start of safelyDoThings")
6262
something <- Sync[F].delay(println("I could do anything"))
63-
.onError{case e => logger.error(e)("Something Went Wrong in safelyDoThings")}
63+
.onError { case e => logger.error(e)("Something Went Wrong in safelyDoThings") }
6464
_ <- logger.info("Logging at end of safelyDoThings")
6565
} yield something
6666

67-
def passForEasierUse[F[_]: Sync: Logger] = for {
67+
def passForEasierUse[F[_]: Sync : Logger] = for {
6868
_ <- Logger[F].info("Logging at start of passForEasierUse")
6969
something <- Sync[F].delay(println("I could do anything"))
70-
.onError{case e => Logger[F].error(e)("Something Went Wrong in passForEasierUse")}
70+
.onError { case e => Logger[F].error(e)("Something Went Wrong in passForEasierUse") }
7171
_ <- Logger[F].info("Logging at end of passForEasierUse")
7272
} yield something
7373
}
@@ -97,12 +97,12 @@ You can use it for your custom `Logger` as well as for Slf4j `Logger`.
9797
import cats.Applicative
9898
import cats.effect.Sync
9999
import org.typelevel.log4cats.Logger
100-
import org.typelevel.log4cats.syntax._
100+
import org.typelevel.log4cats.syntax.*
101101

102102
def successComputation[F[_]: Applicative]: F[Int] = Applicative[F].pure(1)
103103
def errorComputation[F[_]: Sync]: F[Unit] = Sync[F].raiseError[Unit](new Throwable("Sorry!"))
104104

105-
def log[F[_]: Sync: Logger] =
105+
def log[F[_]: Sync : Logger] =
106106
for {
107107
result1 <- successComputation[F]
108108
_ <- info"First result is $result1"
@@ -128,10 +128,12 @@ If you are unsure how to create a new `LoggerFactory[F]` instance, then you can
128128
or `log4cats-noop` modules for concrete implementations.
129129

130130
The quickest fix might be to import needed implicits:
131+
131132
```scala
132133
// assumes dependency on log4cats-slf4j module
133-
import org.typelevel.log4cats._
134-
import org.typelevel.log4cats.slf4j._
134+
135+
import org.typelevel.log4cats.*
136+
import org.typelevel.log4cats.slf4j.*
135137

136138
val logger: SelfAwareStructuredLogger[IO] = LoggerFactory[IO].getLogger
137139

@@ -141,11 +143,12 @@ def anyFSyncLogger[F[_]: Sync]: SelfAwareStructuredLogger[F] = Slf4jFactory[F].g
141143

142144
Alternatively, a mutually exclusive solution is to explicitly create your
143145
`LoggerFactory[F]` instance and pass them around implicitly:
146+
144147
```scala
145148
import cats.effect.IO
146149
import cats.Monad
147-
import cats.syntax.all._
148-
import org.typelevel.log4cats._
150+
import cats.syntax.all.*
151+
import org.typelevel.log4cats.*
149152
import org.typelevel.log4cats.slf4j.Slf4jFactory
150153

151154
// create our LoggerFactory
@@ -156,14 +159,16 @@ val logger: SelfAwareStructuredLogger[IO] = LoggerFactory[IO].getLogger
156159
logger.info("logging in IO!"): IO[Unit]
157160

158161
// basic example of a service using LoggerFactory
159-
class LoggerUsingService[F[_]: LoggerFactory: Monad] {
162+
class LoggerUsingService[F[_]: LoggerFactory : Monad] {
160163
val logger = LoggerFactory[F].getLogger
164+
161165
def use(args: String): F[Unit] =
162166
for {
163167
_ <- logger.info("yay! effect polymorphic code")
164168
_ <- logger.debug(s"and $args")
165169
} yield ()
166170
}
171+
167172
new LoggerUsingService[IO].use("foo")
168173
```
169174

core/shared/src/main/scala-2/org/typelevel/log4cats/internal/LoggerNameMacro.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ private[log4cats] object SharedLoggerNameMacro {
2727

2828
/** Get a logger by reflecting the enclosing class name. */
2929
private[log4cats] def getLoggerNameImpl(c: blackbox.Context) = {
30-
import c.universe._
30+
import c.universe.*
3131

3232
@tailrec def findEnclosingClass(sym: c.universe.Symbol): c.universe.Symbol = {
3333
sym match {

core/shared/src/main/scala/org/typelevel/log4cats/ErrorLogger.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package org.typelevel.log4cats
1818

19-
import cats._
19+
import cats.*
2020
trait ErrorLogger[F[_]] {
2121
def error(t: Throwable)(message: => String): F[Unit]
2222
def warn(t: Throwable)(message: => String): F[Unit]

core/shared/src/main/scala/org/typelevel/log4cats/Logger.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package org.typelevel.log4cats
1818

19-
import cats._
19+
import cats.*
2020
import cats.data.{EitherT, Kleisli, OptionT}
2121

2222
trait Logger[F[_]] extends MessageLogger[F] with ErrorLogger[F] {

core/shared/src/main/scala/org/typelevel/log4cats/LoggerFactory.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package org.typelevel.log4cats
1919
import cats.Functor
2020
import cats.Show.Shown
2121
import cats.data.Kleisli
22-
import cats.syntax.functor._
22+
import cats.syntax.functor.*
2323
import cats.~>
2424
import cats.data.OptionT
2525
import cats.data.EitherT

core/shared/src/main/scala/org/typelevel/log4cats/LoggerFactoryGen.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ package org.typelevel.log4cats
1919
trait LoggerFactoryGen[F[_]] {
2020
type LoggerType <: Logger[F]
2121
def getLogger(implicit name: LoggerName): LoggerType = getLoggerFromName(name.value)
22-
def getLoggerFromClass(clazz: Class[_]): LoggerType = getLoggerFromName(clazz.getName)
22+
def getLoggerFromClass(clazz: Class[?]): LoggerType = getLoggerFromName(clazz.getName)
2323
def create(implicit name: LoggerName): F[LoggerType] = fromName(name.value)
24-
def fromClass(clazz: Class[_]): F[LoggerType] = fromName(clazz.getName)
24+
def fromClass(clazz: Class[?]): F[LoggerType] = fromName(clazz.getName)
2525
def getLoggerFromName(name: String): LoggerType
2626
def fromName(name: String): F[LoggerType]
2727
}
@@ -31,12 +31,12 @@ private[log4cats] trait LoggerFactoryGenCompanion {
3131
lf.getLogger
3232
def getLoggerFromName[F[_]](name: String)(implicit lf: LoggerFactoryGen[F]): lf.LoggerType =
3333
lf.getLoggerFromName(name)
34-
def getLoggerFromClass[F[_]](clazz: Class[_])(implicit lf: LoggerFactoryGen[F]): lf.LoggerType =
34+
def getLoggerFromClass[F[_]](clazz: Class[?])(implicit lf: LoggerFactoryGen[F]): lf.LoggerType =
3535
lf.getLoggerFromClass(clazz)
3636
def create[F[_]](implicit lf: LoggerFactoryGen[F], name: LoggerName): F[lf.LoggerType] =
3737
lf.create
3838
def fromName[F[_]](name: String)(implicit lf: LoggerFactoryGen[F]): F[lf.LoggerType] =
3939
lf.fromName(name)
40-
def fromClass[F[_]](clazz: Class[_])(implicit lf: LoggerFactoryGen[F]): F[lf.LoggerType] =
40+
def fromClass[F[_]](clazz: Class[?])(implicit lf: LoggerFactoryGen[F]): F[lf.LoggerType] =
4141
lf.fromClass(clazz)
4242
}

core/shared/src/main/scala/org/typelevel/log4cats/MessageLogger.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package org.typelevel.log4cats
1818

19-
import cats._
19+
import cats.*
2020

2121
trait MessageLogger[F[_]] {
2222
def error(message: => String): F[Unit]

core/shared/src/main/scala/org/typelevel/log4cats/PagingSelfAwareStructuredLogger.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
package org.typelevel.log4cats
1818

19-
import cats._
19+
import cats.*
2020
import cats.effect.std.UUIDGen
21-
import cats.syntax.all._
21+
import cats.syntax.all.*
2222

2323
import java.io.{PrintWriter, StringWriter}
2424
import java.util.UUID

core/shared/src/main/scala/org/typelevel/log4cats/SelfAwareLogger.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package org.typelevel.log4cats
1818

19-
import cats._
19+
import cats.*
2020

2121
trait SelfAwareLogger[F[_]] extends Logger[F] {
2222
def isTraceEnabled: F[Boolean]

core/shared/src/main/scala/org/typelevel/log4cats/SelfAwareStructuredLogger.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package org.typelevel.log4cats
1818

19-
import cats._
19+
import cats.*
2020
import cats.Show.Shown
2121

2222
trait SelfAwareStructuredLogger[F[_]] extends SelfAwareLogger[F] with StructuredLogger[F] {

core/shared/src/main/scala/org/typelevel/log4cats/StructuredLogger.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package org.typelevel.log4cats
1818

19-
import cats._
19+
import cats.*
2020
import cats.Show.Shown
2121

2222
trait StructuredLogger[F[_]] extends Logger[F] {

core/shared/src/main/scala/org/typelevel/log4cats/extras/DeferredLogger.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package org.typelevel.log4cats.extras
1919
import cats.data.Chain
2020
import cats.effect.kernel.Resource.ExitCase
2121
import cats.effect.kernel.{Concurrent, Ref, Resource}
22-
import cats.syntax.all._
22+
import cats.syntax.all.*
2323
import cats.~>
2424
import org.typelevel.log4cats.Logger
2525

core/shared/src/main/scala/org/typelevel/log4cats/extras/DeferredLoggerFactory.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package org.typelevel.log4cats.extras
1919
import cats.Show.Shown
2020
import cats.data.Chain
2121
import cats.effect.kernel.{Concurrent, Resource}
22-
import cats.syntax.all._
22+
import cats.syntax.all.*
2323
import cats.{~>, Functor}
2424
import org.typelevel.log4cats.{LoggerFactory, SelfAwareStructuredLogger}
2525

core/shared/src/main/scala/org/typelevel/log4cats/extras/DeferredStructuredLogger.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import cats.Show.Shown
2020
import cats.data.Chain
2121
import cats.effect.kernel.Resource.ExitCase
2222
import cats.effect.kernel.{Concurrent, Ref, Resource}
23-
import cats.syntax.all._
23+
import cats.syntax.all.*
2424
import cats.~>
2525
import org.typelevel.log4cats.StructuredLogger
2626

core/shared/src/main/scala/org/typelevel/log4cats/extras/LogLevel.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package org.typelevel.log4cats.extras
1818

19-
import cats._
19+
import cats.*
2020

2121
sealed trait LogLevel
2222
object LogLevel {

core/shared/src/main/scala/org/typelevel/log4cats/extras/LogMessage.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
package org.typelevel.log4cats.extras
1818

19-
import cats._
20-
import cats.syntax.all._
19+
import cats.*
20+
import cats.syntax.all.*
2121
import org.typelevel.log4cats.Logger
2222

2323
final case class LogMessage(level: LogLevel, t: Option[Throwable], message: String)

core/shared/src/main/scala/org/typelevel/log4cats/extras/StructuredLogMessage.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
package org.typelevel.log4cats.extras
1818

1919
import cats.Show
20-
import cats.syntax.all._
20+
import cats.syntax.all.*
2121
import org.typelevel.log4cats.StructuredLogger
2222

2323
final case class StructuredLogMessage(

core/shared/src/main/scala/org/typelevel/log4cats/extras/WriterLogger.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616

1717
package org.typelevel.log4cats.extras
1818

19-
import cats._
20-
import cats.data._
21-
import cats.syntax.all._
22-
import org.typelevel.log4cats._
19+
import cats.*
20+
import cats.data.*
21+
import cats.syntax.all.*
22+
import org.typelevel.log4cats.*
2323

2424
/**
2525
* A `SelfAwareLogger` implemented using `cats.data.Writer`.

core/shared/src/main/scala/org/typelevel/log4cats/extras/WriterStructuredLogger.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
package org.typelevel.log4cats.extras
1818

1919
import cats.data.Writer
20-
import cats.syntax.all._
20+
import cats.syntax.all.*
2121
import cats.{~>, Alternative, Applicative, Foldable, Id}
2222
import org.typelevel.log4cats.{SelfAwareStructuredLogger, StructuredLogger}
2323

core/shared/src/main/scala/org/typelevel/log4cats/extras/WriterTLogger.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616

1717
package org.typelevel.log4cats.extras
1818

19-
import cats._
20-
import cats.data._
21-
import cats.syntax.all._
22-
import org.typelevel.log4cats._
19+
import cats.*
20+
import cats.data.*
21+
import cats.syntax.all.*
22+
import org.typelevel.log4cats.*
2323

2424
/**
2525
* A `SelfAwareLogger` implemented using `cats.data.WriterT`.

core/shared/src/main/scala/org/typelevel/log4cats/extras/WriterTStructuredLogger.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ package org.typelevel.log4cats.extras
1818

1919
import cats.data.WriterT
2020
import cats.kernel.Monoid
21-
import cats.syntax.all._
21+
import cats.syntax.all.*
2222
import cats.{~>, Alternative, Applicative, Foldable, Monad}
2323
import org.typelevel.log4cats.{SelfAwareStructuredLogger, StructuredLogger}
2424

core/shared/src/main/scala/org/typelevel/log4cats/syntax/package.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,18 @@ package org.typelevel.log4cats
1919
package object syntax {
2020
implicit final class LoggerInterpolator(private val sc: StringContext) extends AnyVal {
2121
def error[F[_]](message: Any*)(implicit logger: Logger[F]): F[Unit] =
22-
logger.error(sc.s(message: _*))
22+
logger.error(sc.s(message*))
2323

2424
def warn[F[_]](message: Any*)(implicit logger: Logger[F]): F[Unit] =
25-
logger.warn(sc.s(message: _*))
25+
logger.warn(sc.s(message*))
2626

2727
def info[F[_]](message: Any*)(implicit logger: Logger[F]): F[Unit] =
28-
logger.info(sc.s(message: _*))
28+
logger.info(sc.s(message*))
2929

3030
def debug[F[_]](message: Any*)(implicit logger: Logger[F]): F[Unit] =
31-
logger.debug(sc.s(message: _*))
31+
logger.debug(sc.s(message*))
3232

3333
def trace[F[_]](message: Any*)(implicit logger: Logger[F]): F[Unit] =
34-
logger.trace(sc.s(message: _*))
34+
logger.trace(sc.s(message*))
3535
}
3636
}

core/shared/src/test/scala/org/typelevel/log4cats/extras/syntax/LoggerFactorySyntaxCompilation.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package org.typelevel.log4cats.extras.syntax
1818

19-
import cats._
19+
import cats.*
2020
import cats.data.EitherT
2121
import cats.data.Kleisli
2222
import cats.data.OptionT

core/shared/src/test/scala/org/typelevel/log4cats/extras/syntax/LoggerSyntaxCompilation.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
package org.typelevel.log4cats.extras.syntax
1818

19-
import cats._
19+
import cats.*
2020
import cats.data.{EitherT, Kleisli, OptionT}
21-
import org.typelevel.log4cats._
21+
import org.typelevel.log4cats.*
2222

2323
object LoggerSyntaxCompilation {
2424

0 commit comments

Comments
 (0)