Safe Haskell | None |
---|---|
Language | Haskell2010 |
This is taken from wai-logger and customised for our use
Synopsis
- data StartupLog = StartupLog {
- slLogLevel :: !LogLevel
- slKind :: !Text
- slInfo :: !Value
- data PGLog = PGLog {
- plLogLevel :: !LogLevel
- plMessage :: !Text
- data MetadataLog = MetadataLog {
- mlLogLevel :: !LogLevel
- mlMessage :: !Text
- mlInfo :: !Value
- 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 HttpLogMetadata m = (CommonHttpLogMetadata, ExtraHttpLogMetadata m)
- buildHttpLogMetadata :: forall m. HttpLog m => ParameterizedQueryHashList -> RequestMode -> Maybe (GQLBatchedReqs GQLBatchQueryOperationLog) -> 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 -> ExtraHttpLogMetadata m
- logHttpError :: Logger Hasura -> LoggingSettings -> Maybe UserInfo -> RequestId -> Request -> (ByteString, Maybe Value) -> QErr -> [Header] -> 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)
- olRequestReadTime :: !(Maybe Seconds)
- olQueryExecutionTime :: !(Maybe Seconds)
- olQuery :: !(Maybe Value)
- olRawQuery :: !(Maybe Text)
- olError :: !(Maybe QErr)
- olRequestMode :: !RequestMode
- data BatchOperationSuccessLog = BatchOperationSuccessLog {
- _bolQuery :: !(Maybe Value)
- _bolResponseSize :: !Int64
- _bolQueryExecutionTime :: !Seconds
- data BatchOperationErrorLog = BatchOperationErrorLog {}
- data BatchOperationLog
- data HttpLogContext = HttpLogContext {}
- isQueryIncludedInLogs :: Text -> LoggingSettings -> Bool
- mkHttpAccessLogContext :: Maybe UserInfo -> LoggingSettings -> RequestId -> Request -> (ByteString, Maybe Value) -> 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
- data HttpLogLine = HttpLogLine {}
- mkHttpLog :: HttpLogContext -> HttpLogLine
- logDeprecatedEnvVars :: Logger Hasura -> Environment -> SourceCache -> IO ()
Documentation
data StartupLog Source #
StartupLog | |
|
Instances
Eq StartupLog Source # | |
Defined in Hasura.Server.Logging (==) :: StartupLog -> StartupLog -> Bool # (/=) :: StartupLog -> StartupLog -> Bool # | |
ToJSON StartupLog Source # | |
Defined in Hasura.Server.Logging toJSON :: StartupLog -> Value toEncoding :: StartupLog -> Encoding toJSONList :: [StartupLog] -> Value toEncodingList :: [StartupLog] -> Encoding | |
ToEngineLog StartupLog Hasura Source # | |
Defined in Hasura.Server.Logging toEngineLog :: StartupLog -> (LogLevel, EngineLogType Hasura, Value) Source # |
PGLog | |
|
Instances
Eq PGLog Source # | |
ToJSON PGLog Source # | |
Defined in Hasura.Server.Logging | |
ToEngineLog PGLog Hasura Source # | |
Defined in Hasura.Server.Logging toEngineLog :: PGLog -> (LogLevel, EngineLogType Hasura, Value) Source # |
data MetadataLog Source #
MetadataLog | |
|
Instances
Eq MetadataLog Source # | |
Defined in Hasura.Server.Logging (==) :: MetadataLog -> MetadataLog -> Bool # (/=) :: MetadataLog -> MetadataLog -> Bool # | |
ToJSON MetadataLog Source # | |
Defined in Hasura.Server.Logging toJSON :: MetadataLog -> Value toEncoding :: MetadataLog -> Encoding toJSONList :: [MetadataLog] -> Value toEncodingList :: [MetadataLog] -> Encoding | |
ToEngineLog MetadataLog Hasura Source # | |
Defined in Hasura.Server.Logging toEngineLog :: MetadataLog -> (LogLevel, EngineLogType Hasura, Value) Source # |
data WebHookLog Source #
WebHookLog | |
|
Instances
ToJSON WebHookLog Source # | |
Defined in Hasura.Server.Logging toJSON :: WebHookLog -> Value toEncoding :: WebHookLog -> Encoding toJSONList :: [WebHookLog] -> Value toEncodingList :: [WebHookLog] -> Encoding | |
ToEngineLog WebHookLog Hasura Source # | |
Defined in Hasura.Server.Logging toEngineLog :: WebHookLog -> (LogLevel, EngineLogType Hasura, Value) Source # |
data GQLQueryOperationSuccessLog Source #
GQLQueryOperationSuccessLog captures all the data required to construct an HTTP success log.
Instances
Eq GQLQueryOperationSuccessLog Source # | |
Defined in Hasura.Server.Logging | |
ToJSON GQLQueryOperationSuccessLog Source # | |
Defined in Hasura.Server.Logging toJSON :: GQLQueryOperationSuccessLog -> Value toEncoding :: GQLQueryOperationSuccessLog -> Encoding toJSONList :: [GQLQueryOperationSuccessLog] -> Value toEncodingList :: [GQLQueryOperationSuccessLog] -> Encoding |
data GQLQueryOperationErrorLog Source #
GQLQueryOperationErrorLog captures the request along with the error message
Instances
Eq GQLQueryOperationErrorLog Source # | |
Defined in Hasura.Server.Logging | |
ToJSON GQLQueryOperationErrorLog Source # | |
Defined in Hasura.Server.Logging toJSON :: GQLQueryOperationErrorLog -> Value toEncoding :: GQLQueryOperationErrorLog -> Encoding toJSONList :: [GQLQueryOperationErrorLog] -> Value toEncodingList :: [GQLQueryOperationErrorLog] -> Encoding |
data GQLBatchQueryOperationLog Source #
GQLQueryOperationSuccess !GQLQueryOperationSuccessLog | |
GQLQueryOperationError !GQLQueryOperationErrorLog |
Instances
Eq GQLBatchQueryOperationLog Source # | |
Defined in Hasura.Server.Logging | |
ToJSON GQLBatchQueryOperationLog Source # | |
Defined in Hasura.Server.Logging toJSON :: GQLBatchQueryOperationLog -> Value toEncoding :: GQLBatchQueryOperationLog -> Encoding toJSONList :: [GQLBatchQueryOperationLog] -> Value toEncodingList :: [GQLBatchQueryOperationLog] -> Encoding |
data RequestMode Source #
whether a request is executed in batched mode or not
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
Eq RequestMode Source # | |
Defined in Hasura.Server.Logging (==) :: RequestMode -> RequestMode -> Bool # (/=) :: RequestMode -> RequestMode -> Bool # | |
ToJSON RequestMode Source # | |
Defined in Hasura.Server.Logging toJSON :: RequestMode -> Value toEncoding :: RequestMode -> Encoding toJSONList :: [RequestMode] -> Value toEncodingList :: [RequestMode] -> Encoding |
data CommonHttpLogMetadata Source #
Instances
Eq CommonHttpLogMetadata Source # | |
Defined in Hasura.Server.Logging (==) :: 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 => ParameterizedQueryHashList -> RequestMode -> Maybe (GQLBatchedReqs GQLBatchQueryOperationLog) -> 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
Eq MetadataQueryLoggingMode Source # | |
Defined in Hasura.Server.Logging | |
Show MetadataQueryLoggingMode Source # | |
Defined in Hasura.Server.Logging showsPrec :: Int -> MetadataQueryLoggingMode -> ShowS # show :: MetadataQueryLoggingMode -> String # showList :: [MetadataQueryLoggingMode] -> ShowS # | |
FromJSON MetadataQueryLoggingMode Source # | |
Defined in Hasura.Server.Logging parseJSON :: Value -> Parser MetadataQueryLoggingMode parseJSONList :: Value -> Parser [MetadataQueryLoggingMode] | |
ToJSON MetadataQueryLoggingMode Source # | |
Defined in Hasura.Server.Logging toJSON :: MetadataQueryLoggingMode -> Value toEncoding :: MetadataQueryLoggingMode -> Encoding toJSONList :: [MetadataQueryLoggingMode] -> Value toEncodingList :: [MetadataQueryLoggingMode] -> Encoding | |
FromEnv MetadataQueryLoggingMode Source # | |
Defined in Hasura.Server.Init.Env |
data LoggingSettings Source #
Setting used to control the information in logs
LoggingSettings | |
|
Instances
Eq LoggingSettings Source # | |
Defined in Hasura.Server.Logging (==) :: LoggingSettings -> LoggingSettings -> Bool # (/=) :: LoggingSettings -> LoggingSettings -> Bool # |
class Monad m => HttpLog m where Source #
type ExtraHttpLogMetadata m Source #
Extra http-log metadata that we attach when operating in m
.
emptyExtraHttpLogMetadata :: ExtraHttpLogMetadata m Source #
buildExtraHttpLogMetadata :: ParameterizedQueryHashList -> ExtraHttpLogMetadata m Source #
:: 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 |
-> m () |
:: 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
HttpInfoLog | |
|
Instances
Eq HttpInfoLog Source # | |
Defined in Hasura.Server.Logging (==) :: HttpInfoLog -> HttpInfoLog -> Bool # (/=) :: HttpInfoLog -> HttpInfoLog -> Bool # | |
ToJSON HttpInfoLog Source # | |
Defined in Hasura.Server.Logging toJSON :: HttpInfoLog -> Value toEncoding :: HttpInfoLog -> Encoding toJSONList :: [HttpInfoLog] -> Value toEncodingList :: [HttpInfoLog] -> Encoding |
data OperationLog Source #
Information about a GraphQL/Hasura metadata operation over HTTP
OperationLog | |
|
Instances
Eq OperationLog Source # | |
Defined in Hasura.Server.Logging (==) :: OperationLog -> OperationLog -> Bool # (/=) :: OperationLog -> OperationLog -> Bool # | |
ToJSON OperationLog Source # | |
Defined in Hasura.Server.Logging toJSON :: OperationLog -> Value toEncoding :: OperationLog -> Encoding toJSONList :: [OperationLog] -> Value toEncodingList :: [OperationLog] -> Encoding |
data BatchOperationSuccessLog Source #
BatchOperationSuccessLog
contains the information required for a single
successful operation in a batch request for OSS. This type is a subset of the GQLQueryOperationSuccessLog
BatchOperationSuccessLog | |
|
data BatchOperationErrorLog Source #
BatchOperationSuccessLog
contains the information required for a single
erroneous operation in a batch request for OSS. This type is a subset of the GQLQueryOperationErrorLog
data BatchOperationLog Source #
data HttpLogContext Source #
Instances
Eq HttpLogContext Source # | |
Defined in Hasura.Server.Logging (==) :: HttpLogContext -> HttpLogContext -> Bool # (/=) :: HttpLogContext -> HttpLogContext -> Bool # | |
ToJSON HttpLogContext Source # | |
Defined in Hasura.Server.Logging toJSON :: HttpLogContext -> Value toEncoding :: HttpLogContext -> Encoding toJSONList :: [HttpLogContext] -> Value toEncodingList :: [HttpLogContext] -> Encoding |
isQueryIncludedInLogs :: Text -> LoggingSettings -> Bool Source #
Check if the query
field should be included in the http-log
mkHttpAccessLogContext Source #
:: Maybe UserInfo | Maybe because it may not have been resolved |
-> LoggingSettings | |
-> RequestId | |
-> Request | |
-> (ByteString, Maybe Value) | |
-> ByteString | |
-> Maybe (DiffTime, DiffTime) | |
-> Maybe CompressionType | |
-> [Header] | |
-> RequestMode | |
-> Maybe (GQLBatchedReqs GQLBatchQueryOperationLog) | |
-> HttpLogContext |
mkHttpErrorLogContext Source #
:: Maybe UserInfo | Maybe because it may not have been resolved |
-> LoggingSettings | |
-> RequestId | |
-> Request | |
-> (ByteString, Maybe Value) | |
-> QErr | |
-> Maybe (DiffTime, DiffTime) | |
-> Maybe CompressionType | |
-> [Header] | |
-> HttpLogContext |
data HttpLogLine Source #
logDeprecatedEnvVars :: Logger Hasura -> Environment -> SourceCache -> IO () Source #
Log warning messages for deprecated environment variables