Skip to content

Commit

Permalink
Remember that +compile is a thing
Browse files Browse the repository at this point in the history
  • Loading branch information
morgen-peschke committed May 31, 2024
1 parent f3c11d2 commit 864da2c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,18 @@ object LogMessage {

def t: Option[Throwable] = error

def copy(
l: LogLevel = level,
tOpt: Option[Throwable] = error,
msg: String = message
): LogMessage =
def copy(l: LogLevel, tOpt: Option[Throwable], msg: String): LogMessage =
LogMessageImpl(l, tOpt, () => msg, context)

// Had to add this explicitly because of issues with overloading and default arguments
@nowarn("msg=unused")
private def copy(
ll: LogLevel,
e: Option[Throwable],
lm: () => String,
c: Map[String, String]
): LogMessage =
LogMessageImpl(ll, e, lm, c)
}

implicit val logMessageShow: Show[LogMessage] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,14 @@ object StructuredTestingLogger {
}
mod()
}
def retrieveLogMessages: F[Vector[LogMessage]] = Sync[F].delay(ar.get())

make[F](
traceEnabled = traceEnabled,
debugEnabled = debugEnabled,
infoEnabled = infoEnabled,
warnEnabled = warnEnabled,
errorEnabled = errorEnabled,
appendLogMessage = appendLogMessage,
read = retrieveLogMessages _
read = () => Sync[F].delay(ar.get())
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ object TestingLogger {
}
mod()
}
def retrieveLogMessages: F[Vector[LogMessage]] = Sync[F].delay(ar.get())

make[F](
traceEnabled = traceEnabled,
Expand All @@ -103,7 +102,7 @@ object TestingLogger {
warnEnabled = warnEnabled,
errorEnabled = errorEnabled,
appendLogMessage = appendLogMessage,
read = retrieveLogMessages _
read = () => Sync[F].delay(ar.get())
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ object TestingLoggerFactory {
if (log.ctx.nonEmpty) {
builder.append('\n')
}
log.ctx.foreach { case k -> v =>
log.ctx.foreach { case (k, v) =>
builder.append(" ").append(k).append(':').append(v).append('\n')
}
builder.result()
Expand Down Expand Up @@ -146,7 +146,6 @@ object TestingLoggerFactory {
}
mod()
}
def retrieveLogMessages: F[Vector[LogMessage]] = Sync[F].delay(ar.get())

make[F](
traceEnabled = traceEnabled,
Expand All @@ -155,7 +154,7 @@ object TestingLoggerFactory {
warnEnabled = warnEnabled,
errorEnabled = errorEnabled,
save = appendLogMessage,
read = retrieveLogMessages _
read = () => Sync[F].delay(ar.get())
)
}

Expand Down

0 comments on commit 864da2c

Please sign in to comment.