Module entries (1.15.1)

Log entries within the Google Stackdriver Logging API.

Classes

LogEntry

LogEntry(
    log_name=None,
    labels=None,
    insert_id=None,
    severity=None,
    http_request=None,
    timestamp=None,
    resource=Resource(type="global", labels={}),
    trace=None,
    span_id=None,
    trace_sampled=None,
    source_location=None,
    operation=None,
    logger=None,
    payload=None,
)

Log entry.

Parameters
NameDescription
log_name str

the name of the logger used to post the entry.

labels dict

(optional) mapping of labels for the entry

insert_id text

(optional) the ID used to identify an entry uniquely.

severity str

(optional) severity of event being logged.

http_request dict

(optional) info about HTTP request associated with the entry.

timestamp `datetime.datetime`

(optional) timestamp for the entry

resource Resource

(Optional) Monitored resource of the entry

trace str

(optional) traceid to apply to the entry.

span_id str

(optional) span_id within the trace for the log entry. Specify the trace parameter if span_id is set.

trace_sampled bool

(optional) the sampling decision of the trace associated with the log entry.

source_location dict

(optional) location in source code from which the entry was emitted.

operation dict

(optional) additional information about a potentially long-running operation associated with the log entry.

logger Logger

the logger used to write the entry. See: https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry

ProtobufEntry

ProtobufEntry(
    log_name=None,
    labels=None,
    insert_id=None,
    severity=None,
    http_request=None,
    timestamp=None,
    resource=Resource(type="global", labels={}),
    trace=None,
    span_id=None,
    trace_sampled=None,
    source_location=None,
    operation=None,
    logger=None,
    payload=None,
)

Log entry with protobuf message payload.

Parameters
NameDescription
log_name str

the name of the logger used to post the entry.

labels dict

(optional) mapping of labels for the entry

insert_id text

(optional) the ID used to identify an entry uniquely.

severity str

(optional) severity of event being logged.

http_request dict

(optional) info about HTTP request associated with the entry.

timestamp `datetime.datetime`

(optional) timestamp for the entry

resource Resource

(Optional) Monitored resource of the entry

trace str

(optional) traceid to apply to the entry.

span_id str

(optional) span_id within the trace for the log entry. Specify the trace parameter if span_id is set.

trace_sampled bool

(optional) the sampling decision of the trace associated with the log entry.

source_location dict

(optional) location in source code from which the entry was emitted.

operation dict

(optional) additional information about a potentially long-running operation associated with the log entry.

logger Logger

the logger used to write the entry.

payload protobuf message

payload for the log entry. See: https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry

StructEntry

StructEntry(
    log_name=None,
    labels=None,
    insert_id=None,
    severity=None,
    http_request=None,
    timestamp=None,
    resource=Resource(type="global", labels={}),
    trace=None,
    span_id=None,
    trace_sampled=None,
    source_location=None,
    operation=None,
    logger=None,
    payload=None,
)

Log entry with JSON payload.

Parameters
NameDescription
log_name str

the name of the logger used to post the entry.

labels dict

(optional) mapping of labels for the entry

insert_id text

(optional) the ID used to identify an entry uniquely.

severity str

(optional) severity of event being logged.

http_request dict

(optional) info about HTTP request associated with the entry.

timestamp `datetime.datetime`

(optional) timestamp for the entry

resource Resource

(Optional) Monitored resource of the entry

trace str

(optional) traceid to apply to the entry.

span_id str

(optional) span_id within the trace for the log entry. Specify the trace parameter if span_id is set.

trace_sampled bool

(optional) the sampling decision of the trace associated with the log entry.

source_location dict

(optional) location in source code from which the entry was emitted.

operation dict

(optional) additional information about a potentially long-running operation associated with the log entry.

logger Logger

the logger used to write the entry.

payload dict

payload for the log entry. See: https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry

TextEntry

TextEntry(
    log_name=None,
    labels=None,
    insert_id=None,
    severity=None,
    http_request=None,
    timestamp=None,
    resource=Resource(type="global", labels={}),
    trace=None,
    span_id=None,
    trace_sampled=None,
    source_location=None,
    operation=None,
    logger=None,
    payload=None,
)

Log entry with text payload.

Parameters
NameDescription
log_name str

the name of the logger used to post the entry.

labels dict

(optional) mapping of labels for the entry

insert_id text

(optional) the ID used to identify an entry uniquely.

severity str

(optional) severity of event being logged.

http_request dict

(optional) info about HTTP request associated with the entry.

timestamp `datetime.datetime`

(optional) timestamp for the entry

resource Resource

(Optional) Monitored resource of the entry

trace str

(optional) traceid to apply to the entry.

span_id str

(optional) span_id within the trace for the log entry. Specify the trace parameter if span_id is set.

trace_sampled bool

(optional) the sampling decision of the trace associated with the log entry.

source_location dict

(optional) location in source code from which the entry was emitted.

operation dict

(optional) additional information about a potentially long-running operation associated with the log entry.

logger Logger

the logger used to write the entry.

payload str unicode

payload for the log entry. See: https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry

Modules Functions

logger_name_from_path

logger_name_from_path(path)

Validate a logger URI path and get the logger name.

Parameter
NameDescription
path str

URI path for a logger API request.

Exceptions
TypeDescription
`ValueErrorif the ``path`` is ill-formed or if the project from the ``path`` does not agree with the ``project`` passed in.
Returns
TypeDescription
strLogger name parsed from ``path``.