Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

log_struct severity isn't captured as expected #190

Copy link
Copy link
Closed
@daniel-sanche

Description

@daniel-sanche
Issue body actions

What is the issue:

On using Python client library for Cloud Logging, log_struct is used to send structured logs to Cloud Logging. In structured logging, the log message and metadata are stored in Python dictionary and it is passed to the 1st argument of the method. However, the severity field is not handled as expected because severity needs to be assigned as named argument, which is not explicit from the library document.

Link to friction log:

https://docs.google.com/document/d/19Glb2LC1jXyARXLlJbdRjY1d7I2GolCntI5hck5PuGU/edit?usp=sharing

How bad is it on a scale of 1-5 (1=Minor Annoyance; 5=Total Work Blocker)

4

What were you trying to do?

This issue was originally reported by the customer (TV Asahi), and I reproduced it.

I tried to send structured logs to Cloud Logging with its Python client library.

##What did you expect to happen?

The 1st argument of log_struct accept the dictionary with whole metadata valid for LogEntry and handle the log severity stored in that dictionary.

That is, expecting this code:

logdata = {
    "service": service,
    "message": message,
    "messageId": context.event_id,
    "timepublished": context.timestamp,
    "severity": "warning"
}

vplogger.log_struct(logdata)

is treated as WARNING level log in Cloud Logging.

What actually happened?

It was treated as DEBUG level log.

Metadata

Metadata

Assignees

Labels

api: loggingIssues related to the googleapis/python-logging API.Issues related to the googleapis/python-logging API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.