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
12 from .version
import __soname_major__
14 class _Handler(logging
.Handler
):
15 _LIB_NAME
= 'liblttng-ust-python-agent.so.' + __soname_major__
18 super(self
.__class
__, self
).__init
__(level
=logging
.NOTSET
)
19 self
.setFormatter(logging
.Formatter('%(asctime)s'))
21 # will raise if library is not found: caller should catch
22 self
.agent_lib
= ctypes
.cdll
.LoadLibrary(_Handler
._LIB
_NAME
)
24 def emit(self
, record
):
25 self
.agent_lib
.py_tracepoint(self
.format(record
).encode(),
26 record
.getMessage().encode(),
28 record
.funcName
.encode(),
29 record
.lineno
, record
.levelno
,
31 record
.threadName
.encode())
This page took 0.036518 seconds and 4 git commands to generate.