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.
DigiLogger.cpp
00001 /** 00002 * Copyright (c) 2015 Digi International Inc., 00003 * All rights not expressly granted are reserved. 00004 * 00005 * This Source Code Form is subject to the terms of the Mozilla Public 00006 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 00007 * You can obtain one at http://mozilla.org/MPL/2.0/. 00008 * 00009 * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343 00010 * ======================================================================= 00011 */ 00012 00013 #include "DigiLogger.h" 00014 00015 #include <stdarg.h> 00016 00017 using namespace DigiLog; 00018 00019 LogLevel DigiLogger::_log_level; 00020 00021 DigiLogger* DigiLogger::current_logger; 00022 00023 /* Base Class constructor */ 00024 DigiLogger::DigiLogger() 00025 { 00026 _log_level = LogLevelNone; 00027 00028 current_logger = NULL; 00029 } 00030 00031 /* Class destructor */ 00032 DigiLogger::~DigiLogger() 00033 { 00034 current_logger = NULL; 00035 } 00036 00037 void DigiLogger::set_level(LogLevel log_level) 00038 { 00039 _log_level = log_level; 00040 } 00041 00042 LogLevel DigiLogger::get_level() 00043 { 00044 return _log_level; 00045 } 00046 00047 void DigiLogger::log_format(LogLevel log_level, const char *format, ...) 00048 { 00049 static char buffer[DEBUG_BUFFER_LEN]; 00050 va_list argp; 00051 00052 if (current_logger == NULL) { 00053 return; 00054 } 00055 00056 if (_log_level < log_level) { 00057 return; 00058 } 00059 00060 va_start(argp, format); 00061 vsnprintf(buffer, DEBUG_BUFFER_LEN, format, argp); 00062 va_end(argp); 00063 00064 current_logger->log_buffer(buffer); 00065 } 00066 00067 void DigiLogger::log_buffer(char const * const buffer) 00068 { 00069 (void)(buffer); 00070 }
Generated on Tue Jul 12 2022 18:06:45 by
1.7.2