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