Skip to content

Commit

Permalink
Merge pull request #585 from massimosiani/long-as-value
Browse files Browse the repository at this point in the history
add long to the allowed values
  • Loading branch information
mpilquist authored Oct 1, 2022
2 parents c202765 + 3662f1b commit e1cd586
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
5 changes: 4 additions & 1 deletion modules/core/shared/src/main/scala/TraceValue.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@ object TraceValue {
implicit def stringToTraceValue(value: String): TraceValue = StringValue(value)
implicit def boolToTraceValue(value: Boolean): TraceValue = BooleanValue(value)
implicit def intToTraceValue(value: Int): TraceValue = NumberValue(value)
implicit def longToTraceValue(value: Long): TraceValue = NumberValue(value)
implicit def floatToTraceValue(value: Float): TraceValue = NumberValue(value)
implicit def doubleToTraceValue(value: Double): TraceValue = NumberValue(value)

}
}
15 changes: 15 additions & 0 deletions modules/core/shared/src/test/scala/TraceValueTest.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright (c) 2019-2020 by Rob Norris and Contributors
// This software is licensed under the MIT License (MIT).
// For more information see LICENSE or https://opensource.org/licenses/MIT

package natchez

import cats.Id

object TraceValueTest {
// should compile
def traceValueInt() = Trace.Implicits.noop[Id].put(fields = ("foo", 1))
def traceValueLong() = Trace.Implicits.noop[Id].put(fields = ("foo", 1L))
def traceValueFloat() = Trace.Implicits.noop[Id].put(fields = ("foo", 1.0f))
def traceValueDouble() = Trace.Implicits.noop[Id].put(fields = ("foo", 1.0d))
}

0 comments on commit e1cd586

Please sign in to comment.