AWS IoT Device SDK C: Logging
Generate and print log messages
Return to main page ↑
iot_logging.h
Go to the documentation of this file.
1 /*
2  * IoT Common V1.1.0
3  * Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of
6  * this software and associated documentation files (the "Software"), to deal in
7  * the Software without restriction, including without limitation the rights to
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9  * the Software, and to permit persons to whom the Software is furnished to do so,
10  * subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in all
13  * copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  */
22 
34 #ifndef IOT_LOGGING_H_
35 #define IOT_LOGGING_H_
36 
37 /* The config header is always included first. */
38 #include "iot_config.h"
39 
40 /* Standard includes. */
41 #include <stdbool.h>
42 #include <stddef.h>
43 #include <stdint.h>
44 
75 #define IOT_LOG_NONE 0
76 
83 #define IOT_LOG_ERROR 1
84 
92 #define IOT_LOG_WARN 2
93 
100 #define IOT_LOG_INFO 3
101 
109 #define IOT_LOG_DEBUG 4
110 
145 typedef struct IotLogConfig
146 {
147  bool hideLogLevel;
148  bool hideLibraryName;
149  bool hideTimestring;
151 
188 /* @[declare_logging_generic] */
189 void IotLog_Generic( int32_t libraryLogSetting,
190  const char * const pLibraryName,
191  int32_t messageLevel,
192  const IotLogConfig_t * const pLogConfig,
193  const char * const pFormat,
194  ... );
195 /* @[declare_logging_generic] */
196 
219 /* @[declare_logging_genericprintbuffer] */
220 void IotLog_GenericPrintBuffer( const char * const pLibraryName,
221  const char * const pHeader,
222  const uint8_t * const pBuffer,
223  size_t bufferSize );
224 /* @[declare_logging_genericprintbuffer] */
225 
226 #endif /* ifndef IOT_LOGGING_H_ */
void IotLog_Generic(int32_t libraryLogSetting, const char *const pLibraryName, int32_t messageLevel, const IotLogConfig_t *const pLogConfig, const char *const pFormat,...)
Generic logging function that prints a single message.
Definition: iot_logging.c:188
void IotLog_GenericPrintBuffer(const char *const pLibraryName, const char *const pHeader, const uint8_t *const pBuffer, size_t bufferSize)
Generic function to log the contents of a buffer as bytes.
Definition: iot_logging.c:396
Log message configuration struct.
Definition: iot_logging.h:152