liblightify
Main Page
Modules
Data Structures
Files
File List
Globals
liblightify-private.h
Go to the documentation of this file.
1
/*
2
liblightify -- library to control OSRAM's LIGHTIFY
3
4
Copyright (c) 2015, Tobias Frost <tobi@coldtobi.de>
5
All rights reserved.
6
7
Redistribution and use in source and binary forms, with or without
8
modification, are permitted provided that the following conditions are met:
9
* Redistributions of source code must retain the above copyright
10
notice, this list of conditions and the following disclaimer.
11
* Redistributions in binary form must reproduce the above copyright
12
notice, this list of conditions and the following disclaimer in the
13
documentation and/or other materials provided with the distribution.
14
* Neither the name of the author nor the
15
names of its contributors may be used to endorse or promote products
16
derived from this software without specific prior written permission.
17
18
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
22
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
*/
29
30
#ifndef _LIBLIGHTIFY_PRIVATE_H_
31
#define _LIBLIGHTIFY_PRIVATE_H_
32
33
#ifdef HAVE_CONFIG_H
34
#include "config.h"
35
#endif
36
37
#include <syslog.h>
38
39
#include <
liblightify/liblightify.h
>
40
41
static
inline
void
__attribute__((always_inline,
format
(printf, 2, 3)))
42
lightify_log_null(struct
lightify_ctx
*ctx, const
char
*
format
, ...) {}
43
44
#define lightify_log_cond(ctx, prio, arg...) \
45
do { \
46
if (lightify_get_log_priority(ctx) >= prio) \
47
lightify_log(ctx, prio, __FILE__, __LINE__, __FUNCTION__, ## arg); \
48
} while (0)
49
50
51
#ifdef ENABLE_LOGGING
52
# ifdef ENABLE_DEBUG
53
# define dbg(ctx, arg...) lightify_log_cond(ctx, LOG_DEBUG, ## arg)
54
# else
55
# define dbg(ctx, arg...) lightify_log_null(ctx, ## arg)
56
# endif
57
# define info(ctx, arg...) lightify_log_cond(ctx, LOG_INFO, ## arg)
58
# define err(ctx, arg...) lightify_log_cond(ctx, LOG_ERR, ## arg)
59
#else
60
# define dbg(ctx, arg...) lightify_log_null(ctx, ## arg)
61
# define info(ctx, arg...) lightify_log_null(ctx, ## arg)
62
# define err(ctx, arg...) lightify_log_null(ctx, ## arg)
63
#endif
64
65
#ifndef HAVE_SECURE_GETENV
66
# ifdef HAVE___SECURE_GETENV
67
# define secure_getenv __secure_getenv
68
# else
69
# warning neither secure_getenv nor __secure_getenv is available. Setting logging verbosity via enviorement is not supported.
70
# endif
71
#endif
72
73
#define LIGHTIFY_EXPORT __attribute__ ((visibility("default")))
74
75
#endif
format
static void const char * format
Definition:
liblightify-private.h:42
lightify_ctx
Definition:
context.h:63
liblightify.h
src
liblightify-private.h
Generated by
1.8.11