Google APIs Client Library for C++
HttpScribe Class Reference

Base class for scribe to log HTTP message activity. More...

#include "client/transport/http_scribe.h"

+ Inheritance diagram for HttpScribe:

List of all members.

Public Member Functions

virtual ~HttpScribe ()
 Standard destructor.
void set_max_snippet (int64 n)
 Specifies the max size for captured content snippets.
int64 max_snippet () const
 Returns the max size for captured snippets.
virtual void AboutToSendRequest (const HttpRequest *request)=0
 Notification that the request is about to be sent to the transport.
virtual void ReceivedResponseForRequest (const HttpRequest *request)=0
 Notification that a request has received a response.
virtual void RequestFailedWithTransportError (const HttpRequest *request, const util::Status &error)=0
 Notification that a sent request has encountered a transport error.
void reset_censor (HttpScribeCensor *censor)
const HttpScribeCensorcensor ()
virtual void Checkpoint ()=0
 Checkpoint the scribe data into the writer if it hasnt been done so already.

Protected Member Functions

 HttpScribe (HttpScribeCensor *censor)
 Class is abstract so needs to be specialized to construct.

Detailed Description

Base class for scribe to log HTTP message activity.

This is intended for debugging and diagnostics. A transport permits binding a scribe to it to monitor transport activity. This class provides the interface for the interaction between the HTTP requests and scribes.

Scribes should be thread-safe.

See also:
HttpTransport::set_scribe

Constructor & Destructor Documentation

virtual ~HttpScribe ( ) [virtual]

Standard destructor.

HttpScribe ( HttpScribeCensor censor) [explicit, protected]

Class is abstract so needs to be specialized to construct.

Parameters:
[in]censorProvides policy for censoring data. Ownership is passed.

Member Function Documentation

virtual void AboutToSendRequest ( const HttpRequest request) [pure virtual]

Notification that the request is about to be sent to the transport.

Since the scribe is used in the flow of normal sending activities, it will be the caller's responsibility to reset the requset->body_reader. after invoking this method.

Parameters:
[in]requestThe request being sent.

Implemented in HttpEntryScribe.

const HttpScribeCensor* censor ( ) [inline]
virtual void Checkpoint ( ) [pure virtual]

Checkpoint the scribe data into the writer if it hasnt been done so already.

Implemented in JsonScribe, and HtmlScribe.

int64 max_snippet ( ) const [inline]

Returns the max size for captured snippets.

Returns:
bytes to capture.
virtual void ReceivedResponseForRequest ( const HttpRequest request) [pure virtual]

Notification that a request has received a response.

Since the scribe is used in the flow of normal sending activities, it will be the caller's responsibility to reset the request->response->body_reader after invoking this method.

Parameters:
[in]requestThe request holds its response.

Implemented in HttpEntryScribe.

virtual void RequestFailedWithTransportError ( const HttpRequest request,
const util::Status error 
) [pure virtual]

Notification that a sent request has encountered a transport error.

Transport errors are not HTTP errors. This is a timeout or network-level error.

Parameters:
[in]requestThe request that will never receive a response.
[in]errorThe transport error.

Implemented in HttpEntryScribe.

void reset_censor ( HttpScribeCensor censor) [inline]
void set_max_snippet ( int64  n) [inline]

Specifies the max size for captured content snippets.

The default is unbounded so the whole message will be kept. If you only need part of the payload then you can use this attribute to restrict the size.

Parameters:
[in]nmost bytes to capture.

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines