Skip to content

Python library for sending structured JSON logs to Google Stackdriver in a way that leaves them queryable

License

Notifications You must be signed in to change notification settings

petzeb/google_structlog

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Out of the box setup for python apps to send structured logs to Google Cloud's Stackdriver, in a format that allows stackdriver queries over the structure.

This package sets up structured logging with stackdriver that Just Works(TM): no configuration required. There's no confurability, but virtually no API means its easy to leave behind if you outgrow it.

Usage

from google_structlog import getLogger

logger = getLogger()
logger.warn('Danger Will Robinson', source='Robot', target='Will Robinson', threat='Boredom')

The logger comes from structlog and allows all the options you'd expect on a structlog.get_logger() logger, including binding of repeated attributes:

from google_structlog import getLogger
logger = getLogger()
# Include source= and target= values in the output of all calls to sublogger
sublogger = logger.bind(source='Robot', target='Will Robinson')
sublogger.warn('Danger Will Robinson: impending maintenance', threat='Responsibility')

About

Python library for sending structured JSON logs to Google Stackdriver in a way that leaves them queryable

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%