Skip to main content

pypi

The logging integration enriches the log records with trace ID, span ID and sampling flag. The following attributes will be added to LogRecord:

  • traceId

  • spanId

  • traceSampled

Note that this only takes effect for loggers created after the integration.

Installation

pip install opencensus-ext-logging

Usage

import logging

from opencensus.trace import config_integration
from opencensus.trace.samplers import AlwaysOnSampler
from opencensus.trace.tracer import Tracer

config_integration.trace_integrations(['logging'])
logging.basicConfig(format='%(asctime)s traceId=%(traceId)s spanId=%(spanId)s %(message)s')
tracer = Tracer(sampler=AlwaysOnSampler())

logger = logging.getLogger(__name__)
logger.warning('Before the span')
with tracer.span(name='hello'):
    logger.warning('In the span')
logger.warning('After the span')

References

Release files for opencensus-ext-logging 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for opencensus-ext-logging 0.1.1
File Size Uploaded
opencensus-ext-logging-0.1.1.tar.gz 3.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for opencensus-ext-logging 0.1.1
File Interpreter ABI Platform
opencensus_ext_logging-0.1.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 7.0 kB

Release files / opencensus-ext-logging-0.1.1.tar.gz

Download URL opencensus-ext-logging-0.1.1.tar.gz
Size 3.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c203b70f034151dada529f543af330ba17aaffec27d8a5267d03c713eb1de334
BLAKE2b-256 checksum
How to use checksums
3dba25115de16088d7c3cf694c6ac24b9c5d2c549dcad0d84269033f1c6c9ffd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.2

Release files / opencensus_ext_logging-0.1.1-py2.py3-none-any.whl

Download URL opencensus_ext_logging-0.1.1-py2.py3-none-any.whl
Size 4.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
cfdaf5da5d8b195ff3d1af87a4066a6621a28046173f6be4b0b6caec4a3ca89f
BLAKE2b-256 checksum
How to use checksums
74583a37ed716a28a103b619569f257f1519106ff1bef572fd65a5607b19e11b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.2

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page