AWS IoT Embedded C Device SDK
Main Page
Related Pages
Data Structures
Files
File List
Globals
include
aws_iot_log.h
Go to the documentation of this file.
1
/*
2
* Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License").
5
* You may not use this file except in compliance with the License.
6
* A copy of the License is located at
7
*
8
* http://aws.amazon.com/apache2.0
9
*
10
* or in the "license" file accompanying this file. This file is distributed
11
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12
* express or implied. See the License for the specific language governing
13
* permissions and limitations under the License.
14
*/
15
28
#ifndef _IOT_LOG_H
29
#define _IOT_LOG_H
30
31
#include <stdio.h>
32
#include <stdlib.h>
33
39
#ifdef IOT_DEBUG
40
#define DEBUG(...) \
41
{\
42
printf("DEBUG: %s L#%d ", __PRETTY_FUNCTION__, __LINE__); \
43
printf(__VA_ARGS__); \
44
printf("\n"); \
45
}
46
#else
47
#define DEBUG(...)
48
#endif
49
55
#ifdef IOT_TRACE
56
#define FUNC_ENTRY \
57
{\
58
printf("FUNC_ENTRY: %s L#%d \n", __PRETTY_FUNCTION__, __LINE__); \
59
}
60
#define FUNC_EXIT \
61
{\
62
printf("FUNC_EXIT: %s L#%d \n", __PRETTY_FUNCTION__, __LINE__); \
63
}
64
#define FUNC_EXIT_RC(x) \
65
{\
66
printf("FUNC_EXIT: %s L#%d Return Code : %d \n", __PRETTY_FUNCTION__, __LINE__, x); \
67
return x; \
68
}
69
#else
70
#define FUNC_ENTRY
71
#define FUNC_EXIT
72
#define FUNC_EXIT_RC(x) { return x; }
73
#endif
74
80
#ifdef IOT_INFO
81
#define INFO(...) \
82
{\
83
printf(__VA_ARGS__); \
84
printf("\n"); \
85
}
86
#else
87
#define INFO(...)
88
#endif
89
95
#ifdef IOT_WARN
96
#define WARN(...) \
97
{ \
98
printf("WARN: %s L#%d ", __PRETTY_FUNCTION__, __LINE__); \
99
printf(__VA_ARGS__); \
100
printf("\n"); \
101
}
102
#else
103
#define WARN(...)
104
#endif
105
111
#ifdef IOT_ERROR
112
#define ERROR(...) \
113
{ \
114
printf("ERROR: %s L#%d ", __PRETTY_FUNCTION__, __LINE__); \
115
printf(__VA_ARGS__); \
116
printf("\n"); \
117
}
118
#else
119
#define ERROR(...)
120
#endif
121
122
123
124
#endif // _IOT_LOG_H
Generated by
1.8.10