opencensus-ext-logging-0.1.1
توضیحات
OpenCensus logging Integration
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | opencensus-ext-logging-0.1.1 |
| نام | opencensus-ext-logging |
| نسخه کتابخانه | 0.1.1 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | OpenCensus Authors |
| ایمیل نویسنده | census-developers@googlegroups.com |
| آدرس صفحه اصلی | https://github.com/census-instrumentation/opencensus-python/tree/master/contrib/opencensus-ext-logging |
| آدرس اینترنتی | https://pypi.org/project/opencensus-ext-logging/ |
| مجوز | Apache-2.0 |
OpenCensus logging Integration
============================================================================
|pypi|
.. |pypi| image:: https://badge.fury.io/py/opencensus-ext-logging.svg
:target: https://pypi.org/project/opencensus-ext-logging/
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
-----
.. code:: python
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
----------
* `OpenCensus Project <https://opencensus.io/>`_
نیازمندی
| مقدار | نام |
|---|---|
| <1.0.0,>=0.8.0 | opencensus |
نحوه نصب
نصب پکیج whl opencensus-ext-logging-0.1.1:
pip install opencensus-ext-logging-0.1.1.whl
نصب پکیج tar.gz opencensus-ext-logging-0.1.1:
pip install opencensus-ext-logging-0.1.1.tar.gz