{-# LANGUAGE LambdaCase #-}

module Cardano.Node.Tracing.Compat
  ( toDetailLevel
  , fromDetailLevel
  ) where

import qualified Cardano.BM.Data.Tracer as IOMF
import qualified Cardano.Logging.Types as TD

toDetailLevel :: IOMF.TracingVerbosity -> TD.DetailLevel
toDetailLevel :: TracingVerbosity -> DetailLevel
toDetailLevel = \case
  TracingVerbosity
IOMF.MinimalVerbosity -> DetailLevel
TD.DMinimal
  TracingVerbosity
IOMF.NormalVerbosity  -> DetailLevel
TD.DNormal
  TracingVerbosity
IOMF.MaximalVerbosity -> DetailLevel
TD.DMaximum

fromDetailLevel :: TD.DetailLevel -> IOMF.TracingVerbosity
fromDetailLevel :: DetailLevel -> TracingVerbosity
fromDetailLevel = \case
  DetailLevel
TD.DMinimal  -> TracingVerbosity
IOMF.MinimalVerbosity
  DetailLevel
TD.DNormal   -> TracingVerbosity
IOMF.NormalVerbosity
  DetailLevel
TD.DDetailed -> TracingVerbosity
IOMF.NormalVerbosity
  DetailLevel
TD.DMaximum  -> TracingVerbosity
IOMF.MaximalVerbosity