Skip to content

Commit

Permalink
Add ShouldTrace#shouldTrace
Browse files Browse the repository at this point in the history
Add `ShouldTrace#shouldTrace`, to make boolean checks easier.
  • Loading branch information
NthPortal committed May 8, 2024
1 parent b4f9584 commit a5dba72
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions core/src/main/scala/org/http4s/otel4s/middleware/ShouldTrace.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,21 @@
package org.http4s.otel4s.middleware

/** Whether or not to trace something. */
sealed trait ShouldTrace
sealed trait ShouldTrace {

/** Whether or not to trace something. */
def shouldTrace: Boolean
}

object ShouldTrace {

/** Trace the thing. */
case object Trace extends ShouldTrace
case object Trace extends ShouldTrace {
def shouldTrace: Boolean = true
}

/** Do not trace the thing. */
case object DoNotTrace extends ShouldTrace
case object DoNotTrace extends ShouldTrace {
def shouldTrace: Boolean = false
}
}

0 comments on commit a5dba72

Please sign in to comment.