Vergil Cola
/
MQTTGateway2
Fork of my original MQTTGateway
Embed:
(wiki syntax)
Show/hide line numbers
DigiLoggerMbedSerial.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 "DigiLoggerMbedSerial.h" 00014 00015 using namespace DigiLog; 00016 00017 Serial *DigiLoggerMbedSerial::_log_serial; 00018 00019 /* Class constructor when using a serial port as logging channel */ 00020 DigiLoggerMbedSerial::DigiLoggerMbedSerial(Serial * log_serial, LogLevel log_level) 00021 { 00022 _log_serial = log_serial; 00023 00024 _log_level = log_level; 00025 00026 DigiLogger::current_logger = this; 00027 } 00028 00029 /* Class destructor */ 00030 DigiLoggerMbedSerial::~DigiLoggerMbedSerial() 00031 { 00032 _log_serial = NULL; 00033 DigiLogger::current_logger = NULL; 00034 } 00035 00036 void DigiLoggerMbedSerial::log_buffer(char const * const buffer) 00037 { 00038 if (_log_serial == NULL) { 00039 return; 00040 } 00041 00042 _log_serial->printf("%s", buffer); 00043 fflush(*_log_serial); 00044 } 00045 00046 00047
Generated on Tue Jul 12 2022 18:06:45 by 1.7.2