Mark Radbourne / Mbed 2 deprecated FXOS8700CQ_To_Azure_IoT

Dependencies:   azure_umqtt_c iothub_mqtt_transport mbed-rtos mbed wolfSSL Socket lwip-eth lwip-sys lwip

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers xlogging.c Source File

xlogging.c

00001 // Copyright (c) Microsoft. All rights reserved.
00002 // Licensed under the MIT license. See LICENSE file in the project root for full license information.
00003 
00004 #include "azure_c_shared_utility/xlogging.h"
00005 #include "azure_c_shared_utility/consolelogger.h"
00006 
00007 #ifndef NO_LOGGING
00008 
00009 
00010 #ifdef WINCE
00011 #include <stdarg.h>
00012 
00013 void consolelogger_log(LOG_CATEGORY log_category, const char* file, const char* func, const int line, unsigned int options, const char* format, ...)
00014 {
00015     va_list args;
00016     va_start(args, format);
00017 
00018     time_t t = time(NULL);
00019 
00020     switch (log_category)
00021     {
00022     case LOG_INFO:
00023         (void)printf("Info: ");
00024         break;
00025     case LOG_ERROR:
00026         (void)printf("Error: Time:%.24s File:%s Func:%s Line:%d ", ctime(&t), file, func, line);
00027         break;
00028     default:
00029         break;
00030     }
00031 
00032     (void)vprintf(format, args);
00033     va_end(args);
00034 
00035     (void)log_category;
00036     if (options & LOG_LINE)
00037     {
00038         (void)printf("\r\n");
00039     }
00040 }
00041 #endif
00042 
00043 LOGGER_LOG global_log_function = consolelogger_log;
00044 
00045 
00046 void xlogging_set_log_function(LOGGER_LOG log_function)
00047 {
00048     global_log_function = log_function;
00049 }
00050 
00051 LOGGER_LOG xlogging_get_log_function(void)
00052 {
00053     return global_log_function;
00054 }
00055 
00056 #endif