gargantext-0.0.7.1.5.3: Search, map, share
Safe HaskellSafe-Inferred
LanguageHaskell2010

Gargantext.System.Logging

Synopsis

Documentation

data LogLevel #

Constructors

DEBUG

Debug messages

INFO

Information

NOTICE

Normal runtime conditions

WARNING

General Warnings

ERROR

General Errors

CRITICAL

Severe situations

ALERT

Take immediate action

EMERGENCY

System is unusable

class HasLogger m where #

This is a barebore logging interface which we can extend to plug a proper logging library, without the details of the logger cropping up everywhere in the rest of the codebase.

Associated Types

data Logger m :: Type #

type LogInitParams m :: Type #

type LogPayload m :: Type #

Methods

initLogger :: LogInitParams m -> forall m1. MonadIO m1 => m1 (Logger m) #

destroyLogger :: Logger m -> forall m1. MonadIO m1 => m1 () #

logMsg :: Logger m -> LogLevel -> LogPayload m -> m () #

logTxt :: Logger m -> LogLevel -> Text -> m () #

Instances

Instances details
HasLogger IO #

A plain logger in the IO monad, waiting for more serious logging solutions like the one described in https://gitlab.iscpif.fr/gargantext/haskell-gargantext/issues/229

Instance details

Defined in Gargantext.System.Logging

Associated Types

data Logger IO #

type LogInitParams IO #

type LogPayload IO #

Methods

initLogger :: LogInitParams IO -> forall (m1 :: Type -> Type). MonadIO m1 => m1 (Logger IO) #

destroyLogger :: Logger IO -> forall (m1 :: Type -> Type). MonadIO m1 => m1 () #

logMsg :: Logger IO -> LogLevel -> LogPayload IO -> IO () #

logTxt :: Logger IO -> LogLevel -> Text -> IO () #

HasLogger (GargM DevEnv BackendInternalError) # 
Instance details

Defined in Gargantext.API.Admin.EnvTypes

HasLogger (GargM Env BackendInternalError) # 
Instance details

Defined in Gargantext.API.Admin.EnvTypes

class HasLogger m => MonadLogger m where #

Separate typeclass to get hold of a Logger from within a monad. We keey HasLogger and MonadLogger separate to enforce compositionality, i.e. we can still give instances to HasLogger for things like IO without having to force actually acquiring a logger for those monads.

Methods

getLogger :: m (Logger m) #

logM :: (Monad m, MonadLogger m) => LogLevel -> Text -> m () #

A variant of logTxt that doesn't require passing an explicit Logger.

logLocM :: ExpQ #

Like logM, but it automatically adds the file and line number to the output log.

withLogger :: (MonadBaseControl IO m, MonadIO m, HasLogger m) => LogInitParams m -> (Logger m -> m a) -> m a #

exception-safe combinator that creates and destroys a logger. Think about it like a bracket function from Exception.

withLoggerHoisted :: (MonadBaseControl IO m, HasLogger m) => LogInitParams m -> (Logger m -> IO a) -> IO a #

Like withLogger, but it allows creating a Logger that can run in a different monad from within an IO action.