DIYmall 0.96" Inch I2c IIC Serial 128x64 Oled LCD LED White Display Module
Dependencies: Adafruit_GFX SDFileSystem
Fork of ATT_AWS_IoT_demo by
Diff: AWS_openssl/aws_iot_src/utils/aws_iot_log.h
- Revision:
- 15:6f2798e45099
- Child:
- 28:4650c541b029
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AWS_openssl/aws_iot_src/utils/aws_iot_log.h Thu Dec 01 18:05:38 2016 +0000 @@ -0,0 +1,119 @@ +/* + * Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +/** + * @file aws_iot_log.h + * @brief Logging macros for the SDK. + * This file defines common logging macros with log levels to be used within the SDK. + * These macros can also be used in the IoT application code as a common way to output + * logs. The log levels can be tuned by modifying the makefile. Removing (commenting + * out) the IOT_* statement in the makefile disables that log level. + * + * It is expected that the macros below will be modified or replaced when porting to + * specific hardware platforms as printf may not be the desired behavior. + */ + +// Change to a number between 1 and 4 to debug the TLS connection +// WARNING: the large number of prints may cause timeouts during the connection. +#define DEBUG_LEVEL 0 + +#ifndef _IOT_LOG_H +#define _IOT_LOG_H + +#include <stdio.h> +#include <stdlib.h> +#include "platform.h" + +// Exposes USB Serial function +void pc_print(const char * format, ...); + +/** + * @brief Debug level logging macro. + * + * Macro to expose function, line number as well as desired log message. + */ +#ifdef IOT_DEBUG +#define DEBUG(...) \ + {\ + printf("DEBUG: %s L#%d ", __PRETTY_FUNCTION__, __LINE__); \ + printf(__VA_ARGS__); \ + printf("\n"); \ + } +#else + +#if DEBUG_LEVEL > 0 +#define DEBUG(...) pc_print(__VA_ARGS__); \ + pc_print("\r\n"); +#else +#define DEBUG(...) +#endif + +#endif + +/** + * @brief Info level logging macro. + * + * Macro to expose desired log message. Info messages do not include automatic function names and line numbers. + */ +#ifdef IOT_INFO +#define INFO(...) \ + {\ + printf(__VA_ARGS__); \ + printf("\n"); \ + } +#else +#define INFO(...) pc_print(__VA_ARGS__); \ + pc_print("\r\n"); +#endif + +/** + * @brief Warn level logging macro. + * + * Macro to expose function, line number as well as desired log message. + */ +#ifdef IOT_WARN +#define WARN(...) \ + { \ + printf("WARN: %s L#%d ", __PRETTY_FUNCTION__, __LINE__); \ + printf(__VA_ARGS__); \ + printf("\n"); \ + } +#else +#define WARN(...) pc_print("WARN: "); \ + pc_print(__VA_ARGS__); \ + pc_print("\r\n"); +#endif + +/** + * @brief Error level logging macro. + * + * Macro to expose function, line number as well as desired log message. + */ +#ifdef IOT_ERROR +#define ERROR(...) \ + { \ + printf("ERROR: %s L#%d ", __PRETTY_FUNCTION__, __LINE__); \ + printf(__VA_ARGS__); \ + printf("\n"); \ + } +#else +#define ERROR(...) pc_print("ERROR: "); \ + pc_print(__VA_ARGS__); \ + pc_print("\r\n"); +#endif + +#endif // _IOT_LOG_H + +