diff options
author | Jannis M. Hoffmann <jannis@fehcom.de> | 2023-10-07 22:33:50 +0200 |
---|---|---|
committer | Jannis M. Hoffmann <jannis@fehcom.de> | 2023-10-08 11:35:51 +0200 |
commit | 1978c49bea5b439d993067c055cec47e70db8fd6 (patch) | |
tree | 255caea96a13f95564e6b631be9a4ac55ce33cd9 /src/syslogdevice.cc | |
parent | 3b1278f5459514a6d6364f068ff97b8a0432057b (diff) |
minor refactoring
Diffstat (limited to 'src/syslogdevice.cc')
-rw-r--r-- | src/syslogdevice.cc | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/syslogdevice.cc b/src/syslogdevice.cc index f694835..49162a4 100644 --- a/src/syslogdevice.cc +++ b/src/syslogdevice.cc @@ -1,22 +1,21 @@ -/** -------------------------------------------------------------------- +/** * @file syslogdevice.cc * @brief Implementation of the SyslogDevice class. * @author Andreas Aardal Hanssen * @date 2002, 2003 - * ----------------------------------------------------------------- **/ + */ + #include "syslogdevice.h" #include <string> #include <syslog.h> -using namespace ::std; -using namespace ::Binc; +using namespace Binc; +using std::string; -//------------------------------------------------------------------------ string SyslogDevice::ident; -//------------------------------------------------------------------------ SyslogDevice::SyslogDevice(int f, const char *i, int o, int fa) : IODevice(f) , option(o) @@ -27,31 +26,26 @@ SyslogDevice::SyslogDevice(int f, const char *i, int o, int fa) openlog(ident.c_str(), option, facility); } -//------------------------------------------------------------------------ SyslogDevice::~SyslogDevice(void) { closelog(); } -//------------------------------------------------------------------------ string SyslogDevice::service(void) const { return "log"; } -//------------------------------------------------------------------------ bool SyslogDevice::waitForWrite(void) const { return true; } -//------------------------------------------------------------------------ bool SyslogDevice::waitForRead(void) const { return false; } -//------------------------------------------------------------------------ IODevice::WriteResult SyslogDevice::write(void) { string out; @@ -62,8 +56,9 @@ IODevice::WriteResult SyslogDevice::write(void) if (*i == '\n') { syslog(priority, out.c_str(), out.size()); out = ""; - } else if (*i != '\r') + } else if (*i != '\r') { out += *i; + } } if (out != "") syslog(priority, out.c_str(), out.size()); @@ -72,7 +67,6 @@ IODevice::WriteResult SyslogDevice::write(void) return WriteDone; } -//------------------------------------------------------------------------ bool SyslogDevice::fillInputBuffer(void) { return false; |