Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Hasura.Logging
Synopsis
- class (Eq (EngineLogType impl), Hashable (EngineLogType impl)) => EnabledLogTypes impl where
- parseEnabledLogTypes :: String -> Either String [EngineLogType impl]
- defaultEnabledLogTypes :: HashSet (EngineLogType impl)
- isLogTypeEnabled :: HashSet (EngineLogType impl) -> EngineLogType impl -> Bool
- data family EngineLogType impl
- data Hasura
- data InternalLogTypes
- = ILTUnstructured
- | ILTUnhandledInternalError
- | ILTEventTrigger
- | ILTEventTriggerProcess
- | ILTScheduledTrigger
- | ILTScheduledTriggerProcess
- | ILTCronEventGeneratorProcess
- | ILTWsServer
- | ILTPgClient
- | ILTMetadata
- | ILTTelemetry
- | ILTSchemaSync
- | ILTSourceCatalogMigration
- | ILTStoredIntrospection
- | ILTStoredIntrospectionStorage
- defaultEnabledEngineLogTypes :: HashSet (EngineLogType Hasura)
- isEngineLogTypeEnabled :: HashSet (EngineLogType Hasura) -> EngineLogType Hasura -> Bool
- readLogTypes :: String -> Either String [EngineLogType Hasura]
- userAllowedLogTypes :: [EngineLogType Hasura]
- data LogLevel
- data EngineLog impl = EngineLog {
- _elTimestamp :: !FormattedTime
- _elLevel :: !LogLevel
- _elType :: !(EngineLogType impl)
- _elDetail :: !Value
- class EnabledLogTypes impl => ToEngineLog a impl where
- toEngineLog :: a -> (LogLevel, EngineLogType impl, Value)
- data UnstructuredLog = UnstructuredLog {}
- debugT :: Text -> UnstructuredLog
- debugBS :: ByteString -> UnstructuredLog
- debugLBS :: ByteString -> UnstructuredLog
- data LoggerCtx impl = LoggerCtx {
- _lcLoggerSet :: !LoggerSet
- _lcLogLevel :: !LogLevel
- _lcTimeGetter :: !(IO FormattedTime)
- _lcEnabledLogTypes :: !(HashSet (EngineLogType impl))
- newtype UnhandledInternalErrorLog = UnhandledInternalErrorLog ErrorCall
- data LoggerSettings = LoggerSettings {
- _lsCachedTimestamp :: !Bool
- _lsTimeZone :: !(Maybe TimeZone)
- _lsLevel :: !LogLevel
- defaultLoggerSettings :: Bool -> LogLevel -> LoggerSettings
- getFormattedTime :: Maybe TimeZone -> IO FormattedTime
- mkLoggerCtx :: (MonadIO io, MonadBaseControl IO io) => LoggerSettings -> HashSet (EngineLogType impl) -> ManagedT io (LoggerCtx impl)
- cleanLoggerCtx :: LoggerCtx a -> IO ()
- newtype Logger impl = Logger {
- unLogger :: forall a m. (ToEngineLog a impl, MonadIO m) => a -> m ()
- mkLogger :: ToJSON (EngineLogType impl) => LoggerCtx impl -> Logger impl
- nullLogger :: Logger Hasura
- eventTriggerLogType :: EngineLogType Hasura
- eventTriggerProcessLogType :: EngineLogType Hasura
- scheduledTriggerLogType :: EngineLogType Hasura
- scheduledTriggerProcessLogType :: EngineLogType Hasura
- cronEventGeneratorProcessType :: EngineLogType Hasura
- sourceCatalogMigrationLogType :: EngineLogType Hasura
- data StoredIntrospectionLog = StoredIntrospectionLog {
- silMessage :: Text
- silSourceError :: QErr
- data StoredIntrospectionStorageLog = StoredIntrospectionStorageLog {
- sislMessage :: Text
- sislError :: QErr
- createStatsLogger :: forall m stats impl. (MonadIO m, ToEngineLog stats impl, Monoid stats) => Logger impl -> m (Trigger stats stats)
- closeStatsLogger :: (MonadIO m, EnabledLogTypes impl) => EngineLogType impl -> Logger impl -> Trigger stats stats -> m ()
- logStats :: MonadIO m => Trigger stats stats -> stats -> m ()
Documentation
class (Eq (EngineLogType impl), Hashable (EngineLogType impl)) => EnabledLogTypes impl where Source #
Typeclass representing any type which can be parsed into a list of enabled log types, and has a Set
of default enabled log types, and can find out if a log type is enabled
Methods
parseEnabledLogTypes :: String -> Either String [EngineLogType impl] Source #
defaultEnabledLogTypes :: HashSet (EngineLogType impl) Source #
isLogTypeEnabled :: HashSet (EngineLogType impl) -> EngineLogType impl -> Bool Source #
Instances
EnabledLogTypes Hasura Source # | |
Defined in Hasura.Logging Methods parseEnabledLogTypes :: String -> Either String [EngineLogType Hasura] Source # defaultEnabledLogTypes :: HashSet (EngineLogType Hasura) Source # isLogTypeEnabled :: HashSet (EngineLogType Hasura) -> EngineLogType Hasura -> Bool Source # |
data family EngineLogType impl Source #
A family of EngineLogType types
Instances
Instances
data InternalLogTypes Source #
Constructors
ILTUnstructured | mostly for debug logs - see |
ILTUnhandledInternalError | |
ILTEventTrigger | |
ILTEventTriggerProcess | |
ILTScheduledTrigger | |
ILTScheduledTriggerProcess | |
ILTCronEventGeneratorProcess | |
ILTWsServer | internal logs for the websocket server |
ILTPgClient | |
ILTMetadata | log type for logging metadata related actions; currently used in logging inconsistent metadata |
ILTTelemetry | |
ILTSchemaSync | |
ILTSourceCatalogMigration | |
ILTStoredIntrospection | |
ILTStoredIntrospectionStorage |
Instances
readLogTypes :: String -> Either String [EngineLogType Hasura] Source #
Constructors
LevelDebug | |
LevelInfo | |
LevelWarn | |
LevelError | |
LevelOther Text |
Constructors
EngineLog | |
Fields
|
class EnabledLogTypes impl => ToEngineLog a impl where Source #
Typeclass representing any data type that can be converted to EngineLog
for the purpose of
logging
Methods
toEngineLog :: a -> (LogLevel, EngineLogType impl, Value) Source #
Instances
data UnstructuredLog Source #
Constructors
UnstructuredLog | |
Fields
|
Instances
Show UnstructuredLog Source # | |
Defined in Hasura.Logging Methods showsPrec :: Int -> UnstructuredLog -> ShowS # show :: UnstructuredLog -> String # showList :: [UnstructuredLog] -> ShowS # | |
ToEngineLog UnstructuredLog Hasura Source # | |
Defined in Hasura.Logging Methods toEngineLog :: UnstructuredLog -> (LogLevel, EngineLogType Hasura, Value) Source # |
debugT :: Text -> UnstructuredLog Source #
debugBS :: ByteString -> UnstructuredLog Source #
debugLBS :: ByteString -> UnstructuredLog Source #
Constructors
LoggerCtx | |
Fields
|
Unhandled Internal Errors
newtype UnhandledInternalErrorLog Source #
We expect situations where there are code paths that should not occur and we throw
an error
on this code paths. If our assumptions are incorrect and infact
these errors do occur, we want to log them.
Constructors
UnhandledInternalErrorLog ErrorCall |
Instances
ToEngineLog UnhandledInternalErrorLog Hasura Source # | |
Defined in Hasura.Logging Methods toEngineLog :: UnhandledInternalErrorLog -> (LogLevel, EngineLogType Hasura, Value) Source # |
LoggerSettings
data LoggerSettings Source #
Constructors
LoggerSettings | |
Fields
|
Instances
Show LoggerSettings Source # | |
Defined in Hasura.Logging Methods showsPrec :: Int -> LoggerSettings -> ShowS # show :: LoggerSettings -> String # showList :: [LoggerSettings] -> ShowS # | |
Eq LoggerSettings Source # | |
Defined in Hasura.Logging Methods (==) :: LoggerSettings -> LoggerSettings -> Bool # (/=) :: LoggerSettings -> LoggerSettings -> Bool # |
defaultLoggerSettings :: Bool -> LogLevel -> LoggerSettings Source #
mkLoggerCtx :: (MonadIO io, MonadBaseControl IO io) => LoggerSettings -> HashSet (EngineLogType impl) -> ManagedT io (LoggerCtx impl) Source #
Creates a new LoggerCtx
.
The underlying LoggerSet
is bound to the ManagedT
context: when it exits,
the log will be flushed and cleared regardless of whether it was exited
properly or not (ManagedT
uses bracket
underneath). This guarantees that
the logs will always be flushed, even in case of error, avoiding a repeat of
https://github.com/hasura/graphql-engine/issues/4772.
cleanLoggerCtx :: LoggerCtx a -> IO () Source #
Constructors
Logger | |
Fields
|
data StoredIntrospectionLog Source #
Emit when stored introspection is used
Constructors
StoredIntrospectionLog | |
Fields
|
Instances
data StoredIntrospectionStorageLog Source #
Logs related to errors while interacting with the stored introspection storage
Constructors
StoredIntrospectionStorageLog | |
Fields
|
Instances
ToJSON StoredIntrospectionStorageLog Source # | |
Defined in Hasura.Logging | |
Generic StoredIntrospectionStorageLog Source # | |
Defined in Hasura.Logging Associated Types type Rep StoredIntrospectionStorageLog :: Type -> Type # | |
ToEngineLog StoredIntrospectionStorageLog Hasura Source # | |
Defined in Hasura.Logging Methods toEngineLog :: StoredIntrospectionStorageLog -> (LogLevel, EngineLogType Hasura, Value) Source # | |
type Rep StoredIntrospectionStorageLog Source # | |
Defined in Hasura.Logging type Rep StoredIntrospectionStorageLog = D1 ('MetaData "StoredIntrospectionStorageLog" "Hasura.Logging" "graphql-engine-1.0.0-inplace" 'False) (C1 ('MetaCons "StoredIntrospectionStorageLog" 'PrefixI 'True) (S1 ('MetaSel ('Just "sislMessage") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "sislError") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 QErr))) |
createStatsLogger :: forall m stats impl. (MonadIO m, ToEngineLog stats impl, Monoid stats) => Logger impl -> m (Trigger stats stats) Source #
A logger useful for accumulating and logging stats, in tight polling loops. It also
debounces to not flood with excessive logs. Use @logStats
to record statistics for logging.
closeStatsLogger :: (MonadIO m, EnabledLogTypes impl) => EngineLogType impl -> Logger impl -> Trigger stats stats -> m () Source #
Safely close the statistics logger. When occurred, exception is logged.