RDK Documentation (Open Sourced RDK Components)
btrCore_logger.h
1
/*
2
* If not stated otherwise in this file or this component's Licenses.txt file the
3
* following copyright and licenses apply:
4
*
5
* Copyright 2016 RDK Management
6
*
7
* Licensed under the Apache License, Version 2.0 (the "License");
8
* you may not use this file except in compliance with the License.
9
* You may obtain a copy of the License at
10
*
11
* http://www.apache.org/licenses/LICENSE-2.0
12
*
13
* Unless required by applicable law or agreed to in writing, software
14
* distributed under the License is distributed on an "AS IS" BASIS,
15
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
* See the License for the specific language governing permissions and
17
* limitations under the License.
18
*/
19
#ifndef __BTRCORE_LOGGER_H__
20
#define __BTRCORE_LOGGER_H__
21
22
23
#define PREFIX(format) "%d\t: %s - " format
24
25
26
#ifdef RDK_LOGGER_ENABLED
27
28
#include "
rdk_debug.h
"
29
30
extern
int
b_rdk_logger_enabled;
31
32
#define LOG_ERROR(format, ...) if(b_rdk_logger_enabled) {\
33
RDK_LOG(RDK_LOG_ERROR, "LOG.RDK.BTRCORE", format, __VA_ARGS__);\
34
} else {\
35
fprintf (stderr, format, __VA_ARGS__);\
36
}
37
#define LOG_WARN(format, ...) if(b_rdk_logger_enabled) {\
38
RDK_LOG(RDK_LOG_WARN, "LOG.RDK.BTRCORE", format, __VA_ARGS__);\
39
} else {\
40
fprintf (stderr, format, __VA_ARGS__);\
41
}
42
#define LOG_INFO(format, ...) if(b_rdk_logger_enabled) {\
43
RDK_LOG(RDK_LOG_INFO, "LOG.RDK.BTRCORE", format, __VA_ARGS__);\
44
} else {\
45
fprintf (stderr, format, __VA_ARGS__);\
46
}
47
#define LOG_DEBUG(format, ...) if(b_rdk_logger_enabled) {\
48
RDK_LOG(RDK_LOG_DEBUG, "LOG.RDK.BTRCORE", format, __VA_ARGS__);\
49
} else {\
50
fprintf (stderr, format, __VA_ARGS__);\
51
}
52
#define LOG_TRACE(format, ...) if(b_rdk_logger_enabled) {\
53
RDK_LOG(RDK_LOG_TRACE1, "LOG.RDK.BTRCORE", format, __VA_ARGS__);\
54
} else {\
55
fprintf (stderr, format, __VA_ARGS__);\
56
}
57
#else
58
59
#define LOG_ERROR(format, ...) fprintf(stderr, format, __VA_ARGS__)
60
#define LOG_WARN(format, ...) fprintf(stderr, format, __VA_ARGS__)
61
#define LOG_INFO(format, ...) fprintf(stderr, format, __VA_ARGS__)
62
#define LOG_DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
63
#define LOG_TRACE(format, ...) fprintf(stderr, format, __VA_ARGS__)
64
65
#endif
66
67
68
#define BTRCORELOG_ERROR(format, ...) LOG_ERROR(PREFIX(format), __LINE__, __FUNCTION__, ##__VA_ARGS__)
69
#define BTRCORELOG_WARN(format, ...) LOG_WARN(PREFIX(format), __LINE__, __FUNCTION__, ##__VA_ARGS__)
70
#define BTRCORELOG_INFO(format, ...) LOG_INFO(PREFIX(format), __LINE__, __FUNCTION__, ##__VA_ARGS__)
71
#define BTRCORELOG_DEBUG(format, ...) LOG_DEBUG(PREFIX(format), __LINE__, __FUNCTION__, ##__VA_ARGS__)
72
#define BTRCORELOG_TRACE(format, ...) LOG_TRACE(PREFIX(format), __LINE__, __FUNCTION__, ##__VA_ARGS__)
73
74
75
#endif
/* __BTRCORE_LOGGER_H__ */
rdk_debug.h
components
generic
bluetooth
include
logger
btrCore_logger.h
Generated on Thu Feb 9 2023 06:32:28 for RDK Documentation (Open Sourced RDK Components) by
1.8.17