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.cpp
00001 /** 00002 * @file Logger.cpp 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 // Class support 00024 #include "mbed-connector-interface/Logger.h" 00025 00026 // Constructor 00027 Logger::Logger(const Serial *pc) 00028 { 00029 this->m_pc = (Serial *)pc; 00030 } 00031 00032 // Copy Constructor 00033 Logger::Logger(const Logger &logger) 00034 { 00035 this->m_pc = logger.m_pc; 00036 } 00037 00038 // Destructor 00039 Logger::~Logger() 00040 { 00041 } 00042 00043 // Log the ouput to the attached serial console 00044 void Logger::logIt(const char *format,...) 00045 { 00046 #if !defined(QUIET_LOGGING) 00047 // build the variable args into a string 00048 va_list args; 00049 char buffer[LOGGER_BUFFER_LENGTH+1]; 00050 memset(buffer,0,LOGGER_BUFFER_LENGTH+1); 00051 va_start(args, format); 00052 vsnprintf(buffer,LOGGER_BUFFER_LENGTH,format,args); 00053 00054 // clean up... 00055 va_end(args); 00056 00057 // print it... 00058 if (this->m_pc != NULL) 00059 this->m_pc->printf("%s",buffer); 00060 // else 00061 // std::printf("%s",buffer); 00062 #endif 00063 } 00064
Generated on Wed Jul 13 2022 01:24:02 by
