1#!/usr/bin/env python 2# -*- coding: utf-8 -*- 3 4""" 5Syslog built-in backend. 6""" 7 8__author__ = "Paul Durrant <paul.durrant@citrix.com>" 9__copyright__ = "Copyright 2016, Citrix Systems Inc." 10__license__ = "GPL version 2 or (at your option) any later version" 11 12__maintainer__ = "Stefan Hajnoczi" 13__email__ = "stefanha@redhat.com" 14 15 16from tracetool import out 17 18 19PUBLIC = True 20 21 22def generate_h_begin(events, group): 23 out('#include <syslog.h>', 24 '') 25 26 27def generate_h(event, group): 28 argnames = ", ".join(event.args.names()) 29 if len(event.args) > 0: 30 argnames = ", " + argnames 31 32 if "vcpu" in event.properties: 33 # already checked on the generic format code 34 cond = "true" 35 else: 36 cond = "trace_event_get_state(%s)" % ("TRACE_" + event.name.upper()) 37 38 out(' if (%(cond)s) {', 39 ' syslog(LOG_INFO, "%(name)s " %(fmt)s %(argnames)s);', 40 ' }', 41 cond=cond, 42 name=event.name, 43 fmt=event.fmt.rstrip("\n"), 44 argnames=argnames) 45 46 47def generate_h_backend_dstate(event, group): 48 out(' trace_event_get_state_dynamic_by_id(%(event_id)s) || \\', 49 event_id="TRACE_" + event.name.upper()) 50