Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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
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 |
data family EngineLogType impl Source #
A family of EngineLogType types
Instances
Instances
data InternalLogTypes Source #
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 #
EngineLog | |
|
class EnabledLogTypes impl => ToEngineLog a impl where Source #
Typeclass representing any data type that can be converted to EngineLog
for the purpose of
logging
toEngineLog :: a -> (LogLevel, EngineLogType impl, Value) Source #
Instances
data UnstructuredLog Source #
Instances
Show UnstructuredLog Source # | |
Defined in Hasura.Logging showsPrec :: Int -> UnstructuredLog -> ShowS # show :: UnstructuredLog -> String # showList :: [UnstructuredLog] -> ShowS # | |
ToEngineLog UnstructuredLog Hasura Source # | |
Defined in Hasura.Logging toEngineLog :: UnstructuredLog -> (LogLevel, EngineLogType Hasura, Value) Source # |
debugT :: Text -> UnstructuredLog Source #
debugBS :: ByteString -> UnstructuredLog Source #
debugLBS :: ByteString -> UnstructuredLog Source #
LoggerCtx | |
|
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.
Instances
LoggerSettings
data LoggerSettings Source #
LoggerSettings | |
|
Instances
Show LoggerSettings Source # | |
Defined in Hasura.Logging showsPrec :: Int -> LoggerSettings -> ShowS # show :: LoggerSettings -> String # showList :: [LoggerSettings] -> ShowS # | |
Eq LoggerSettings Source # | |
Defined in Hasura.Logging (==) :: 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 #
Logger | |
|
data StoredIntrospectionLog Source #
Emit when stored introspection is used
StoredIntrospectionLog | |
|
Instances
ToJSON StoredIntrospectionLog Source # | |
Defined in Hasura.Logging | |
Generic StoredIntrospectionLog Source # | |
Defined in Hasura.Logging type Rep StoredIntrospectionLog :: Type -> Type # | |
ToEngineLog StoredIntrospectionLog Hasura Source # | |
Defined in Hasura.Logging | |
type Rep StoredIntrospectionLog Source # | |
Defined in Hasura.Logging type Rep StoredIntrospectionLog = D1 ('MetaData "StoredIntrospectionLog" "Hasura.Logging" "graphql-engine-1.0.0-inplace" 'False) (C1 ('MetaCons "StoredIntrospectionLog" 'PrefixI 'True) (S1 ('MetaSel ('Just "silMessage") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "silSourceError") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 QErr))) |
data StoredIntrospectionStorageLog Source #
Logs related to errors while interacting with the stored introspection storage
Instances
ToJSON StoredIntrospectionStorageLog Source # | |
Defined in Hasura.Logging | |
Generic StoredIntrospectionStorageLog Source # | |
Defined in Hasura.Logging type Rep StoredIntrospectionStorageLog :: Type -> Type # | |
ToEngineLog StoredIntrospectionStorageLog Hasura Source # | |
Defined in Hasura.Logging | |
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.