Skip to content

Commit

Permalink
Merge pull request #17 from herp-inc/herp-logger-export-hooks
Browse files Browse the repository at this point in the history
Export hooks
  • Loading branch information
ynishinaka authored Apr 23, 2024
2 parents 8cf42ec + ce88701 commit a9ea06a
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ This logger requires 'Otel.Tracer' to retrieve OpenTelemetry context additionall
-}
module OpenTelemetry.Instrumentation.Herp.Logger.Datadog (
appendHooksToConfig,
datadogHooks,
) where

import Control.Applicative (Alternative ((<|>)))
Expand Down Expand Up @@ -41,6 +42,10 @@ appendHooksToConfig :: Otel.TracerProvider -> Orig.LoggerConfig -> Orig.LoggerCo
appendHooksToConfig provider config@Orig.LoggerConfig {Orig.hooks} = config {Orig.hooks = hooks {Orig.logHook = logHook provider . Orig.logHook hooks}}


datadogHooks :: Otel.TracerProvider -> Orig.Hooks
datadogHooks provider = Orig.Hooks $ logHook provider


logHook :: Otel.TracerProvider -> (Orig.Logger -> Orig.Payload -> IO ()) -> Orig.Logger -> Orig.Payload -> IO ()
logHook provider hook logger payload = do
let
Expand Down

0 comments on commit a9ea06a

Please sign in to comment.