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.
Fork of mbedConnectorInterfaceWithDM by
Logger.h
00001 /** 00002 * @file Logger.h 00003 * @brief mbed CoAP Endpoint logging class 00004 * @author Doug Anson/Chris Paola 00005 * @version 1.0 00006 * @see 00007 * 00008 * Copyright (c) 2014 00009 * 00010 * Licensed under the Apache License, Version 2.0 (the "License"); 00011 * you may not use this file except in compliance with the License. 00012 * You may obtain a copy of the License at 00013 * 00014 * http://www.apache.org/licenses/LICENSE-2.0 00015 * 00016 * Unless required by applicable law or agreed to in writing, software 00017 * distributed under the License is distributed on an "AS IS" BASIS, 00018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00019 * See the License for the specific language governing permissions and 00020 * limitations under the License. 00021 */ 00022 00023 #ifndef __LOGGER_H__ 00024 #define __LOGGER_H__ 00025 00026 // Configuration 00027 #include "mbed-connector-interface/mbedConnectorInterface.h" 00028 00029 // Support for std args 00030 #include <stdarg.h> 00031 00032 // mbed support 00033 #if defined(MCI_USE_YOTTA) 00034 // mbed support 00035 #include "mbed-drivers/mbed.h" 00036 #else 00037 // mbed support 00038 #include "mbed.h" 00039 #endif 00040 00041 // logging macro 00042 #define log(x, ...) logIt(x"\r\n",##__VA_ARGS__) 00043 00044 /** Logger class 00045 */ 00046 class Logger 00047 { 00048 public: 00049 /** 00050 Default constructor 00051 @param pc input BufferedSerial instance for debugging (if NULL, no debugging output will occur in the library) 00052 */ 00053 Logger(const Serial *pc); 00054 00055 /** 00056 Copy constructor 00057 @param logger input Logger instance to deep copy 00058 */ 00059 Logger(const Logger &logger); 00060 00061 /** 00062 Destructor 00063 */ 00064 virtual ~Logger(); 00065 00066 /** 00067 Log output to the given serial console 00068 @param format input format for the logging 00069 @param ... input (variable arguments to display) 00070 */ 00071 void logIt(const char *format, ...); 00072 00073 private: 00074 Serial *m_pc; 00075 }; 00076 00077 #endif // __LOGGER_H__ 00078
Generated on Wed Jul 13 2022 01:24:02 by
