1 # -*- coding: utf-8 -*-
3 # SPDX-License-Identifier: LGPL-2.1-only
5 # Copyright (C) 2015 Philippe Proulx <pproulx@efficios.com>
6 # Copyright (C) 2014 David Goulet <dgoulet@efficios.com>
8 from __future__
import unicode_literals
13 class _Handler(logging
.Handler
):
14 _LIB_NAME
= 'liblttng-ust-python-agent.so.0'
17 super(self
.__class
__, self
).__init
__(level
=logging
.NOTSET
)
18 self
.setFormatter(logging
.Formatter('%(asctime)s'))
20 # will raise if library is not found: caller should catch
21 self
.agent_lib
= ctypes
.cdll
.LoadLibrary(_Handler
._LIB
_NAME
)
23 def emit(self
, record
):
24 self
.agent_lib
.py_tracepoint(self
.format(record
).encode(),
25 record
.getMessage().encode(),
27 record
.funcName
.encode(),
28 record
.lineno
, record
.levelno
,
30 record
.threadName
.encode())
This page took 0.040199 seconds and 4 git commands to generate.