Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Hasura.Server.Logging
Description
This is taken from wai-logger and customised for our use
Synopsis
- data StartupLog = StartupLog {}
- data PGLog = PGLog {
- plLogLevel :: !LogLevel
- plMessage :: !Value
- data MetadataLog = MetadataLog {}
- mkInconsMetadataLog :: [InconsistentMetadata] -> MetadataLog
- data WebHookLog = WebHookLog {
- whlLogLevel :: !LogLevel
- whlStatusCode :: !(Maybe Status)
- whlUrl :: !Text
- whlMethod :: !StdMethod
- whlError :: !(Maybe HttpException)
- whlResponse :: !(Maybe Text)
- whlMessage :: !(Maybe Text)
- data GQLQueryOperationSuccessLog = GQLQueryOperationSuccessLog {}
- data GQLQueryOperationErrorLog = GQLQueryOperationErrorLog {
- gqelQuery :: !GQLReqUnparsed
- gqelError :: !QErr
- data GQLBatchQueryOperationLog
- data RequestMode
- data CommonHttpLogMetadata = CommonHttpLogMetadata {}
- type HttpLogGraphQLInfo = (CommonHttpLogMetadata, ParameterizedQueryHashList)
- emptyHttpLogGraphQLInfo :: HttpLogGraphQLInfo
- type HttpLogMetadata m = (CommonHttpLogMetadata, ExtraHttpLogMetadata m)
- buildHttpLogMetadata :: forall m. HttpLog m => HttpLogGraphQLInfo -> ExtraUserInfo -> HttpLogMetadata m
- emptyHttpLogMetadata :: forall m. HttpLog m => HttpLogMetadata m
- data MetadataQueryLoggingMode
- data LoggingSettings = LoggingSettings {}
- class Monad m => HttpLog m where
- type ExtraHttpLogMetadata m
- emptyExtraHttpLogMetadata :: ExtraHttpLogMetadata m
- buildExtraHttpLogMetadata :: ParameterizedQueryHashList -> ExtraUserInfo -> ExtraHttpLogMetadata m
- logHttpError :: Logger Hasura -> LoggingSettings -> Maybe UserInfo -> RequestId -> Request -> (ByteString, Maybe Value) -> QErr -> [Header] -> HttpLogMetadata m -> m ()
- logHttpSuccess :: Logger Hasura -> LoggingSettings -> Maybe UserInfo -> RequestId -> Request -> (ByteString, Maybe Value) -> ByteString -> ByteString -> Maybe (DiffTime, DiffTime) -> Maybe CompressionType -> [Header] -> HttpLogMetadata m -> m ()
- data HttpInfoLog = HttpInfoLog {
- hlStatus :: !Status
- hlMethod :: !Text
- hlSource :: !IpAddress
- hlPath :: !Text
- hlHttpVersion :: !HttpVersion
- hlCompression :: !(Maybe CompressionType)
- hlHeaders :: ![Header]
- data OperationLog = OperationLog {
- olRequestId :: !RequestId
- olUserVars :: !(Maybe SessionVariables)
- olResponseSize :: !(Maybe Int64)
- olUncompressedResponseSize :: !Int64
- olRequestReadTime :: !(Maybe Seconds)
- olQueryExecutionTime :: !(Maybe Seconds)
- olQuery :: !(Maybe Value)
- olRawQuery :: !(Maybe Text)
- olError :: !(Maybe QErr)
- olRequestMode :: !RequestMode
- data HttpLogContext = HttpLogContext {
- hlcHttpInfo :: !HttpInfoLog
- hlcOperation :: !OperationLog
- hlcRequestId :: !RequestId
- hlcBatchedOperations :: !(Maybe (NonEmpty BatchOperationLog))
- mkHttpAccessLogContext :: Maybe UserInfo -> LoggingSettings -> RequestId -> Request -> (ByteString, Maybe Value) -> Int64 -> ByteString -> Maybe (DiffTime, DiffTime) -> Maybe CompressionType -> [Header] -> RequestMode -> Maybe (GQLBatchedReqs GQLBatchQueryOperationLog) -> HttpLogContext
- mkHttpErrorLogContext :: Maybe UserInfo -> LoggingSettings -> RequestId -> Request -> (ByteString, Maybe Value) -> QErr -> Maybe (DiffTime, DiffTime) -> Maybe CompressionType -> [Header] -> HttpLogContext
- mkHttpLog :: HttpLogContext -> HttpLogLine
- logDeprecatedEnvVars :: Logger Hasura -> Environment -> SourceCache -> IO ()
- data SchemaSyncThreadType
- data SchemaSyncLog = SchemaSyncLog {}
Documentation
data StartupLog Source #
Constructors
StartupLog | |
Instances
ToJSON StartupLog Source # | |
Defined in Hasura.Server.Logging Methods toJSON :: StartupLog -> Value Source # toEncoding :: StartupLog -> Encoding Source # toJSONList :: [StartupLog] -> Value Source # toEncodingList :: [StartupLog] -> Encoding Source # | |
Eq StartupLog Source # | |
Defined in Hasura.Server.Logging | |
ToEngineLog StartupLog Hasura Source # | |
Defined in Hasura.Server.Logging Methods toEngineLog :: StartupLog -> (LogLevel, EngineLogType Hasura, Value) Source # |
Constructors
PGLog | |
Fields
|
data MetadataLog Source #
Constructors
MetadataLog | |
Instances
ToJSON MetadataLog Source # | |
Defined in Hasura.Server.Logging Methods toJSON :: MetadataLog -> Value Source # toEncoding :: MetadataLog -> Encoding Source # toJSONList :: [MetadataLog] -> Value Source # toEncodingList :: [MetadataLog] -> Encoding Source # | |
Eq MetadataLog Source # | |
Defined in Hasura.Server.Logging | |
ToEngineLog MetadataLog Hasura Source # | |
Defined in Hasura.Server.Logging Methods toEngineLog :: MetadataLog -> (LogLevel, EngineLogType Hasura, Value) Source # |
data WebHookLog Source #
Constructors
WebHookLog | |
Fields
|
Instances
ToJSON WebHookLog Source # | |
Defined in Hasura.Server.Logging Methods toJSON :: WebHookLog -> Value Source # toEncoding :: WebHookLog -> Encoding Source # toJSONList :: [WebHookLog] -> Value Source # toEncodingList :: [WebHookLog] -> Encoding Source # | |
ToEngineLog WebHookLog Hasura Source # | |
Defined in Hasura.Server.Logging Methods toEngineLog :: WebHookLog -> (LogLevel, EngineLogType Hasura, Value) Source # |
data GQLQueryOperationSuccessLog Source #
GQLQueryOperationSuccessLog captures all the data required to construct an HTTP success log.
Constructors
GQLQueryOperationSuccessLog | |
Instances
data GQLQueryOperationErrorLog Source #
GQLQueryOperationErrorLog captures the request along with the error message
Constructors
GQLQueryOperationErrorLog | |
Fields
|
Instances
data GQLBatchQueryOperationLog Source #
Constructors
GQLQueryOperationSuccess !GQLQueryOperationSuccessLog | |
GQLQueryOperationError !GQLQueryOperationErrorLog |
Instances
ToJSON GQLBatchQueryOperationLog Source # | |
Defined in Hasura.Server.Logging Methods toJSON :: GQLBatchQueryOperationLog -> Value Source # toEncoding :: GQLBatchQueryOperationLog -> Encoding Source # toJSONList :: [GQLBatchQueryOperationLog] -> Value Source # toEncodingList :: [GQLBatchQueryOperationLog] -> Encoding Source # | |
Eq GQLBatchQueryOperationLog Source # | |
Defined in Hasura.Server.Logging Methods (==) :: GQLBatchQueryOperationLog -> GQLBatchQueryOperationLog -> Bool # (/=) :: GQLBatchQueryOperationLog -> GQLBatchQueryOperationLog -> Bool # |
data RequestMode Source #
whether a request is executed in batched mode or not
Constructors
RequestModeBatched | this request is batched |
RequestModeSingle | this is a single request |
RequestModeNonBatchable | this request is of a kind for which batching is not done or does not make sense |
RequestModeError | the execution of this request failed |
Instances
ToJSON RequestMode Source # | |
Defined in Hasura.Server.Logging Methods toJSON :: RequestMode -> Value Source # toEncoding :: RequestMode -> Encoding Source # toJSONList :: [RequestMode] -> Value Source # toEncodingList :: [RequestMode] -> Encoding Source # | |
Eq RequestMode Source # | |
Defined in Hasura.Server.Logging |
data CommonHttpLogMetadata Source #
Constructors
CommonHttpLogMetadata | |
Instances
Eq CommonHttpLogMetadata Source # | |
Defined in Hasura.Server.Logging Methods (==) :: CommonHttpLogMetadata -> CommonHttpLogMetadata -> Bool # (/=) :: CommonHttpLogMetadata -> CommonHttpLogMetadata -> Bool # |
type HttpLogMetadata m = (CommonHttpLogMetadata, ExtraHttpLogMetadata m) Source #
The http-log metadata attached to HTTP requests running in the monad m
, split into a
common portion that is present regardless of m
, and a monad-specific one defined in the
HttpLog
instance.
This allows us to not have to duplicate the code that generates the common part of the metadata across OSS and Pro, so that instances only have to implement the part of it unique to them.
buildHttpLogMetadata :: forall m. HttpLog m => HttpLogGraphQLInfo -> ExtraUserInfo -> HttpLogMetadata m Source #
emptyHttpLogMetadata :: forall m. HttpLog m => HttpLogMetadata m Source #
synonym for clarity, writing `emptyHttpLogMetadata m` instead of `def
(HttpLogMetadata m)`
data MetadataQueryLoggingMode Source #
Instances
data LoggingSettings Source #
Setting used to control the information in logs
Constructors
LoggingSettings | |
Fields
|
Instances
Eq LoggingSettings Source # | |
Defined in Hasura.Server.Logging Methods (==) :: LoggingSettings -> LoggingSettings -> Bool # (/=) :: LoggingSettings -> LoggingSettings -> Bool # |
class Monad m => HttpLog m where Source #
Associated Types
type ExtraHttpLogMetadata m Source #
Extra http-log metadata that we attach when operating in m
.
Methods
emptyExtraHttpLogMetadata :: ExtraHttpLogMetadata m Source #
buildExtraHttpLogMetadata :: ParameterizedQueryHashList -> ExtraUserInfo -> ExtraHttpLogMetadata m Source #
Arguments
:: Logger Hasura | the logger |
-> LoggingSettings | setting used to control the information in logs |
-> Maybe UserInfo | user info may or may not be present (error can happen during user resolution) |
-> RequestId | request id of the request |
-> Request | the Wai.Request object |
-> (ByteString, Maybe Value) | the request body and parsed request |
-> QErr | the error |
-> [Header] | list of request headers |
-> HttpLogMetadata m | |
-> m () |
Arguments
:: Logger Hasura | the logger |
-> LoggingSettings | setting used to control the information in logs |
-> Maybe UserInfo | user info may or may not be present (error can happen during user resolution) |
-> RequestId | request id of the request |
-> Request | the Wai.Request object |
-> (ByteString, Maybe Value) | the request body and parsed request |
-> ByteString | the response bytes |
-> ByteString | the compressed response bytes ^ TODO (from master): make the above two type represented |
-> Maybe (DiffTime, DiffTime) | IO/network wait time and service time (respectively) for this request, if available. |
-> Maybe CompressionType | possible compression type |
-> [Header] | list of request headers |
-> HttpLogMetadata m | |
-> m () |
Instances
data HttpInfoLog Source #
Log information about the HTTP request
Constructors
HttpInfoLog | |
Fields
|
Instances
ToJSON HttpInfoLog Source # | |
Defined in Hasura.Server.Logging Methods toJSON :: HttpInfoLog -> Value Source # toEncoding :: HttpInfoLog -> Encoding Source # toJSONList :: [HttpInfoLog] -> Value Source # toEncodingList :: [HttpInfoLog] -> Encoding Source # | |
Eq HttpInfoLog Source # | |
Defined in Hasura.Server.Logging |
data OperationLog Source #
Information about a GraphQL/Hasura metadata operation over HTTP
Constructors
OperationLog | |
Fields
|
Instances
data HttpLogContext Source #
Constructors
HttpLogContext | |
Fields
|
Instances
ToJSON HttpLogContext Source # | |
Defined in Hasura.Server.Logging Methods toJSON :: HttpLogContext -> Value Source # toEncoding :: HttpLogContext -> Encoding Source # toJSONList :: [HttpLogContext] -> Value Source # toEncodingList :: [HttpLogContext] -> Encoding Source # | |
Generic HttpLogContext Source # | |
Defined in Hasura.Server.Logging Associated Types type Rep HttpLogContext :: Type -> Type # Methods from :: HttpLogContext -> Rep HttpLogContext x # to :: Rep HttpLogContext x -> HttpLogContext # | |
Eq HttpLogContext Source # | |
Defined in Hasura.Server.Logging Methods (==) :: HttpLogContext -> HttpLogContext -> Bool # (/=) :: HttpLogContext -> HttpLogContext -> Bool # | |
type Rep HttpLogContext Source # | |
Defined in Hasura.Server.Logging |
mkHttpAccessLogContext Source #
Arguments
:: Maybe UserInfo | Maybe because it may not have been resolved |
-> LoggingSettings | |
-> RequestId | |
-> Request | |
-> (ByteString, Maybe Value) | |
-> Int64 | Size of response body, before compression |
-> ByteString | |
-> Maybe (DiffTime, DiffTime) | |
-> Maybe CompressionType | |
-> [Header] | |
-> RequestMode | |
-> Maybe (GQLBatchedReqs GQLBatchQueryOperationLog) | |
-> HttpLogContext |
mkHttpErrorLogContext Source #
Arguments
:: Maybe UserInfo | Maybe because it may not have been resolved |
-> LoggingSettings | |
-> RequestId | |
-> Request | |
-> (ByteString, Maybe Value) | |
-> QErr | |
-> Maybe (DiffTime, DiffTime) | |
-> Maybe CompressionType | |
-> [Header] | |
-> HttpLogContext |
mkHttpLog :: HttpLogContext -> HttpLogLine Source #
logDeprecatedEnvVars :: Logger Hasura -> Environment -> SourceCache -> IO () Source #
Log warning messages for deprecated environment variables
data SchemaSyncThreadType Source #
Constructors
TTListener | |
TTProcessor | |
TTMetadataApi |
Instances
Show SchemaSyncThreadType Source # | |
Defined in Hasura.Server.Logging Methods showsPrec :: Int -> SchemaSyncThreadType -> ShowS # show :: SchemaSyncThreadType -> String # showList :: [SchemaSyncThreadType] -> ShowS # | |
Eq SchemaSyncThreadType Source # | |
Defined in Hasura.Server.Logging Methods (==) :: SchemaSyncThreadType -> SchemaSyncThreadType -> Bool # (/=) :: SchemaSyncThreadType -> SchemaSyncThreadType -> Bool # |
data SchemaSyncLog Source #
Constructors
SchemaSyncLog | |
Fields
|
Instances
ToJSON SchemaSyncLog Source # | |
Defined in Hasura.Server.Logging Methods toJSON :: SchemaSyncLog -> Value Source # toEncoding :: SchemaSyncLog -> Encoding Source # toJSONList :: [SchemaSyncLog] -> Value Source # toEncodingList :: [SchemaSyncLog] -> Encoding Source # | |
Show SchemaSyncLog Source # | |
Defined in Hasura.Server.Logging Methods showsPrec :: Int -> SchemaSyncLog -> ShowS # show :: SchemaSyncLog -> String # showList :: [SchemaSyncLog] -> ShowS # | |
Eq SchemaSyncLog Source # | |
Defined in Hasura.Server.Logging Methods (==) :: SchemaSyncLog -> SchemaSyncLog -> Bool # (/=) :: SchemaSyncLog -> SchemaSyncLog -> Bool # | |
ToEngineLog SchemaSyncLog Hasura Source # | |
Defined in Hasura.Server.Logging Methods toEngineLog :: SchemaSyncLog -> (LogLevel, EngineLogType Hasura, Value) Source # |