AWS IoT Embedded C Device SDK
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_INFO
56 #define INFO(...) \
57  {\
58  printf(__VA_ARGS__); \
59  printf("\n"); \
60  }
61 #else
62 #define INFO(...)
63 #endif
64 
70 #ifdef IOT_WARN
71 #define WARN(...) \
72  { \
73  printf("WARN: %s L#%d ", __PRETTY_FUNCTION__, __LINE__); \
74  printf(__VA_ARGS__); \
75  printf("\n"); \
76  }
77 #else
78 #define WARN(...)
79 #endif
80 
86 #ifdef IOT_ERROR
87 #define ERROR(...) \
88  { \
89  printf("ERROR: %s L#%d ", __PRETTY_FUNCTION__, __LINE__); \
90  printf(__VA_ARGS__); \
91  printf("\n"); \
92  }
93 #else
94 #define ERROR(...)
95 #endif
96 
97 #endif // _IOT_LOG_H