Safe Haskell | None |
---|---|
Language | Haskell2010 |
Hasura.Server.Logging
Description
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 #
Constructors
StartupLog | |
Fields
|
Instances
Eq StartupLog Source # | |
Defined in Hasura.Server.Logging | |
ToJSON StartupLog Source # | |
Defined in Hasura.Server.Logging Methods toJSON :: StartupLog -> Value toEncoding :: StartupLog -> Encoding toJSONList :: [StartupLog] -> Value toEncodingList :: [StartupLog] -> Encoding | |
ToEngineLog StartupLog Hasura Source # | |
Defined in Hasura.Server.Logging Methods toEngineLog :: StartupLog -> (LogLevel, EngineLogType Hasura, Value) Source # |
Constructors
PGLog | |
Fields
|
Instances
Eq PGLog Source # | |
ToJSON PGLog Source # | |
Defined in Hasura.Server.Logging Methods toEncoding :: PGLog -> Encoding toJSONList :: [PGLog] -> Value toEncodingList :: [PGLog] -> Encoding | |
ToEngineLog PGLog Hasura Source # | |
Defined in Hasura.Server.Logging Methods toEngineLog :: PGLog -> (LogLevel, EngineLogType Hasura, Value) Source # |
data MetadataLog Source #
Constructors
MetadataLog | |
Fields
|
Instances
Eq MetadataLog Source # | |
Defined in Hasura.Server.Logging | |
ToJSON MetadataLog Source # | |
Defined in Hasura.Server.Logging Methods toJSON :: MetadataLog -> Value toEncoding :: MetadataLog -> Encoding toJSONList :: [MetadataLog] -> Value toEncodingList :: [MetadataLog] -> Encoding | |
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 toEncoding :: WebHookLog -> Encoding toJSONList :: [WebHookLog] -> Value toEncodingList :: [WebHookLog] -> Encoding | |
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
Eq GQLQueryOperationSuccessLog Source # | |
Defined in Hasura.Server.Logging Methods (==) :: GQLQueryOperationSuccessLog -> GQLQueryOperationSuccessLog -> Bool # (/=) :: GQLQueryOperationSuccessLog -> GQLQueryOperationSuccessLog -> Bool # | |
ToJSON GQLQueryOperationSuccessLog Source # | |
Defined in Hasura.Server.Logging Methods toJSON :: GQLQueryOperationSuccessLog -> Value toEncoding :: GQLQueryOperationSuccessLog -> Encoding toJSONList :: [GQLQueryOperationSuccessLog] -> Value toEncodingList :: [GQLQueryOperationSuccessLog] -> Encoding |
data GQLQueryOperationErrorLog Source #
GQLQueryOperationErrorLog captures the request along with the error message
Constructors
GQLQueryOperationErrorLog | |
Fields
|
Instances
Eq GQLQueryOperationErrorLog Source # | |
Defined in Hasura.Server.Logging Methods (==) :: GQLQueryOperationErrorLog -> GQLQueryOperationErrorLog -> Bool # (/=) :: GQLQueryOperationErrorLog -> GQLQueryOperationErrorLog -> Bool # | |
ToJSON GQLQueryOperationErrorLog Source # | |
Defined in Hasura.Server.Logging Methods toJSON :: GQLQueryOperationErrorLog -> Value toEncoding :: GQLQueryOperationErrorLog -> Encoding toJSONList :: [GQLQueryOperationErrorLog] -> Value toEncodingList :: [GQLQueryOperationErrorLog] -> Encoding |
data GQLBatchQueryOperationLog Source #
Constructors
GQLQueryOperationSuccess !GQLQueryOperationSuccessLog | |
GQLQueryOperationError !GQLQueryOperationErrorLog |
Instances
Eq GQLBatchQueryOperationLog Source # | |
Defined in Hasura.Server.Logging Methods (==) :: GQLBatchQueryOperationLog -> GQLBatchQueryOperationLog -> Bool # (/=) :: GQLBatchQueryOperationLog -> GQLBatchQueryOperationLog -> Bool # | |
ToJSON GQLBatchQueryOperationLog Source # | |
Defined in Hasura.Server.Logging Methods 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
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
Eq RequestMode Source # | |
Defined in Hasura.Server.Logging | |
ToJSON RequestMode Source # | |
Defined in Hasura.Server.Logging Methods toJSON :: RequestMode -> Value toEncoding :: RequestMode -> Encoding toJSONList :: [RequestMode] -> Value toEncodingList :: [RequestMode] -> Encoding |
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 => 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 Methods (==) :: MetadataQueryLoggingMode -> MetadataQueryLoggingMode -> Bool # (/=) :: MetadataQueryLoggingMode -> MetadataQueryLoggingMode -> Bool # | |
Show MetadataQueryLoggingMode Source # | |
Defined in Hasura.Server.Logging Methods showsPrec :: Int -> MetadataQueryLoggingMode -> ShowS # show :: MetadataQueryLoggingMode -> String # showList :: [MetadataQueryLoggingMode] -> ShowS # | |
FromJSON MetadataQueryLoggingMode Source # | |
Defined in Hasura.Server.Logging Methods parseJSON :: Value -> Parser MetadataQueryLoggingMode parseJSONList :: Value -> Parser [MetadataQueryLoggingMode] | |
ToJSON MetadataQueryLoggingMode Source # | |
Defined in Hasura.Server.Logging Methods 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
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 -> 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 |
-> 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
Eq HttpInfoLog Source # | |
Defined in Hasura.Server.Logging | |
ToJSON HttpInfoLog Source # | |
Defined in Hasura.Server.Logging Methods toJSON :: HttpInfoLog -> Value toEncoding :: HttpInfoLog -> Encoding toJSONList :: [HttpInfoLog] -> Value toEncodingList :: [HttpInfoLog] -> Encoding |
data OperationLog Source #
Information about a GraphQL/Hasura metadata operation over HTTP
Constructors
OperationLog | |
Fields
|
Instances
Eq OperationLog Source # | |
Defined in Hasura.Server.Logging | |
ToJSON OperationLog Source # | |
Defined in Hasura.Server.Logging Methods 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
Constructors
BatchOperationSuccessLog | |
Fields
|
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
Constructors
BatchOperationErrorLog | |
data BatchOperationLog Source #
data HttpLogContext Source #
Constructors
HttpLogContext | |
Fields |
Instances
Eq HttpLogContext Source # | |
Defined in Hasura.Server.Logging Methods (==) :: HttpLogContext -> HttpLogContext -> Bool # (/=) :: HttpLogContext -> HttpLogContext -> Bool # | |
ToJSON HttpLogContext Source # | |
Defined in Hasura.Server.Logging Methods 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 #
Arguments
:: 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 #
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 |
data HttpLogLine Source #
Constructors
HttpLogLine | |
Fields
|
logDeprecatedEnvVars :: Logger Hasura -> Environment -> SourceCache -> IO () Source #
Log warning messages for deprecated environment variables