1 # -*- coding: utf-8 -*-
3 # Copyright (C) 2015 - Philippe Proulx <pproulx@efficios.com>
4 # Copyright (C) 2014 - David Goulet <dgoulet@efficios.com>
6 # This library is free software; you can redistribute it and/or modify it under
7 # the terms of the GNU Lesser General Public License as published by the Free
8 # Software Foundation; version 2.1 of the License.
10 # This library is distributed in the hope that it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
15 # You should have received a copy of the GNU Lesser General Public License
16 # along with this library; if not, write to the Free Software Foundation, Inc.,
17 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 from __future__
import unicode_literals
24 class _Handler(logging
.Handler
):
25 _LIB_NAME
= 'liblttng-ust-python-agent.so'
28 super(self
.__class
__, self
).__init
__(level
=logging
.NOTSET
)
29 self
.setFormatter(logging
.Formatter('%(asctime)s'))
31 # will raise if library is not found: caller should catch
32 self
.agent_lib
= ctypes
.cdll
.LoadLibrary(_Handler
._LIB
_NAME
)
34 def emit(self
, record
):
35 self
.agent_lib
.py_tracepoint(self
.format(record
).encode(),
36 record
.getMessage().encode(),
38 record
.funcName
.encode(),
39 record
.lineno
, record
.levelno
,
41 record
.threadName
.encode())
This page took 0.049421 seconds and 4 git commands to generate.