Soup.Logger

g GObject.GInterface GObject.GInterface Soup.SessionFeature Soup.SessionFeature GObject.GInterface->Soup.SessionFeature GObject.Object GObject.Object Soup.Logger Soup.Logger GObject.Object->Soup.Logger Soup.SessionFeature->Soup.Logger

Subclasses:

None

Methods

Inherited:

GObject.Object (37), Soup.SessionFeature (5)

Structs:

GObject.ObjectClass (5)

class

new (level, max_body_size)

attach (session)

detach (session)

set_printer (printer, *printer_data)

set_request_filter (request_filter, *filter_data)

set_response_filter (response_filter, *filter_data)

Virtual Methods

Inherited:

GObject.Object (7), Soup.SessionFeature (8)

Properties

Name

Type

Flags

Short Description

level

Soup.LoggerLogLevel

r/w

The level of logging output

max-body-size

int

r/w

The maximum body size to output

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class Soup.Logger(**kwargs)
Bases:

GObject.Object, Soup.SessionFeature

Abstract:

No

Structure:

Soup.LoggerClass

classmethod new(level, max_body_size)
Parameters:
  • level (Soup.LoggerLogLevel) – the debug level

  • max_body_size (int) – the maximum body size to output, or -1

Returns:

a new Soup.Logger

Return type:

Soup.Logger

Creates a new Soup.Logger with the given debug level. If level is Soup.LoggerLogLevel.BODY, max_body_size gives the maximum number of bytes of the body that will be logged. (-1 means “no limit”.)

If you need finer control over what message parts are and aren’t logged, use Soup.Logger.set_request_filter() and Soup.Logger.set_response_filter().

attach(session)
Parameters:

session (Soup.Session) – a Soup.Session

Sets self to watch session and print debug information for its messages.

(The session will take a reference on self, which will be removed when you call Soup.Logger.detach(), or when the session is destroyed.)

Deprecated since version ???: Use Soup.Session.add_feature() instead.

detach(session)
Parameters:

session (Soup.Session) – a Soup.Session

Stops self from watching session.

Deprecated since version ???: Use Soup.Session.remove_feature() instead.

set_printer(printer, *printer_data)
Parameters:

Sets up an alternate log printing routine, if you don’t want the log to go to stdout.

set_request_filter(request_filter, *filter_data)
Parameters:
  • request_filter (Soup.LoggerFilter) – the callback for request debugging

  • filter_data (object or None) – data to pass to the callback

Sets up a filter to determine the log level for a given request. For each HTTP request self will invoke request_filter to determine how much (if any) of that request to log. (If you do not set a request filter, self will just always log requests at the level passed to Soup.Logger.new().)

set_response_filter(response_filter, *filter_data)
Parameters:
  • response_filter (Soup.LoggerFilter) – the callback for response debugging

  • filter_data (object or None) – data to pass to the callback

Sets up a filter to determine the log level for a given response. For each HTTP response self will invoke response_filter to determine how much (if any) of that response to log. (If you do not set a response filter, self will just always log responses at the level passed to Soup.Logger.new().)

Property Details

Soup.Logger.props.level
Name:

level

Type:

Soup.LoggerLogLevel

Default Value:

Soup.LoggerLogLevel.MINIMAL

Flags:

READABLE, WRITABLE

The level of logging output

New in version 2.56.

Soup.Logger.props.max_body_size
Name:

max-body-size

Type:

int

Default Value:

-1

Flags:

READABLE, WRITABLE

If Soup.Logger :level is Soup.LoggerLogLevel.BODY, this gives the maximum number of bytes of the body that will be logged. (-1 means “no limit”.)

New in version 2.56.