summaryrefslogtreecommitdiff
path: root/Com/MusicMeetsComics/Server/Logger.hs
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2020-04-10 17:49:01 -0700
committerBen Sima <ben@bsima.me>2020-04-10 18:23:38 -0700
commit76112b8bd26c0e282d5479ccae9d79c4dc28c35d (patch)
tree7c3343bae164552efeaed3665c7b7f1a03e825bf /Com/MusicMeetsComics/Server/Logger.hs
parent61e21346a6947327bf5394f6c73499621c494986 (diff)
Replace Config/Init/Logger with envy and simpler code
Idk what I was thinking, I dodn't need any of that stuff.
Diffstat (limited to 'Com/MusicMeetsComics/Server/Logger.hs')
-rw-r--r--Com/MusicMeetsComics/Server/Logger.hs51
1 files changed, 0 insertions, 51 deletions
diff --git a/Com/MusicMeetsComics/Server/Logger.hs b/Com/MusicMeetsComics/Server/Logger.hs
deleted file mode 100644
index 5091b23..0000000
--- a/Com/MusicMeetsComics/Server/Logger.hs
+++ /dev/null
@@ -1,51 +0,0 @@
-{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE NoImplicitPrelude #-}
-module Com.MusicMeetsComics.Server.Logger
- ( adapt
- , defaultLogEnv
- , Katip.logMsg
- , Katip.runKatipT
- , Katip.KatipT(..)
- , Katip.Katip(..)
- , Katip.LogEnv
- , Katip.Severity(..)
- )
-where
-
-import qualified Control.Monad.Logger as Logger
-import qualified Katip
-import Protolude
-import qualified System.IO as IO
-import qualified System.Log.FastLogger as FastLogger
-
-defaultLogEnv :: IO Katip.LogEnv
-defaultLogEnv = do
- handleScribe <- Katip.mkHandleScribe Katip.ColorIfTerminal
- IO.stdout
- (Katip.permitItem Katip.DebugS)
- Katip.V2
- env <- Katip.initLogEnv "hero" "production"
- Katip.registerScribe "stdout" handleScribe Katip.defaultScribeSettings env
-
-fromLevel :: Logger.LogLevel -> Katip.Severity
-fromLevel Logger.LevelDebug = Katip.DebugS
-fromLevel Logger.LevelInfo = Katip.InfoS
-fromLevel Logger.LevelWarn = Katip.WarningS
-fromLevel Logger.LevelError = Katip.ErrorS
-fromLevel (Logger.LevelOther _) = Katip.NoticeS
-
--- | Transforms Katip logMsg into monadLoggerLog to be used inside
--- MonadLogger monad
-adapt
- :: (FastLogger.ToLogStr msg, Applicative m, Katip.Katip m)
- => (Katip.Namespace -> Katip.Severity -> Katip.LogStr -> m ())
- -> Logger.Loc
- -> Logger.LogSource
- -> Logger.LogLevel
- -> msg
- -> m ()
-adapt f _ src lvl msg = f ns (fromLevel lvl) $ logStr' msg
- where
- ns = Katip.Namespace [src]
- -- not sure how fast this is going to be
- logStr' = Katip.logStr . FastLogger.fromLogStr . Logger.toLogStr