Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: azure_umqtt_c iothub_mqtt_transport mbed-rtos mbed wolfSSL Socket lwip-eth lwip-sys lwip
azure_c_shared_utility/consolelogger.c@3:c0556ff7b8e3, 2016-12-08 (annotated)
- Committer:
- markrad
- Date:
- Thu Dec 08 00:11:40 2016 +0000
- Revision:
- 3:c0556ff7b8e3
Hack the code to get restart working
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| markrad | 3:c0556ff7b8e3 | 1 | // Copyright (c) Microsoft. All rights reserved. |
| markrad | 3:c0556ff7b8e3 | 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. |
| markrad | 3:c0556ff7b8e3 | 3 | |
| markrad | 3:c0556ff7b8e3 | 4 | #include <stdlib.h> |
| markrad | 3:c0556ff7b8e3 | 5 | #ifdef _CRTDBG_MAP_ALLOC |
| markrad | 3:c0556ff7b8e3 | 6 | #include <crtdbg.h> |
| markrad | 3:c0556ff7b8e3 | 7 | #endif |
| markrad | 3:c0556ff7b8e3 | 8 | #include <stdarg.h> |
| markrad | 3:c0556ff7b8e3 | 9 | #include <stdio.h> |
| markrad | 3:c0556ff7b8e3 | 10 | #include "azure_c_shared_utility/xlogging.h" |
| markrad | 3:c0556ff7b8e3 | 11 | |
| markrad | 3:c0556ff7b8e3 | 12 | void consolelogger_log(LOG_CATEGORY log_category, const char* file, const char* func, const int line, unsigned int options, const char* format, ...) |
| markrad | 3:c0556ff7b8e3 | 13 | { |
| markrad | 3:c0556ff7b8e3 | 14 | va_list args; |
| markrad | 3:c0556ff7b8e3 | 15 | va_start(args, format); |
| markrad | 3:c0556ff7b8e3 | 16 | |
| markrad | 3:c0556ff7b8e3 | 17 | time_t t = time(NULL); |
| markrad | 3:c0556ff7b8e3 | 18 | |
| markrad | 3:c0556ff7b8e3 | 19 | switch (log_category) |
| markrad | 3:c0556ff7b8e3 | 20 | { |
| markrad | 3:c0556ff7b8e3 | 21 | case LOG_INFO: |
| markrad | 3:c0556ff7b8e3 | 22 | (void)printf("Info: "); |
| markrad | 3:c0556ff7b8e3 | 23 | break; |
| markrad | 3:c0556ff7b8e3 | 24 | case LOG_ERROR: |
| markrad | 3:c0556ff7b8e3 | 25 | (void)printf("Error: Time:%.24s File:%s Func:%s Line:%d ", ctime(&t), file, func, line); |
| markrad | 3:c0556ff7b8e3 | 26 | break; |
| markrad | 3:c0556ff7b8e3 | 27 | default: |
| markrad | 3:c0556ff7b8e3 | 28 | break; |
| markrad | 3:c0556ff7b8e3 | 29 | } |
| markrad | 3:c0556ff7b8e3 | 30 | |
| markrad | 3:c0556ff7b8e3 | 31 | (void)vprintf(format, args); |
| markrad | 3:c0556ff7b8e3 | 32 | va_end(args); |
| markrad | 3:c0556ff7b8e3 | 33 | |
| markrad | 3:c0556ff7b8e3 | 34 | (void)log_category; |
| markrad | 3:c0556ff7b8e3 | 35 | if (options & LOG_LINE) |
| markrad | 3:c0556ff7b8e3 | 36 | { |
| markrad | 3:c0556ff7b8e3 | 37 | (void)printf("\r\n"); |
| markrad | 3:c0556ff7b8e3 | 38 | } |
| markrad | 3:c0556ff7b8e3 | 39 | } |