aboutsummaryrefslogtreecommitdiffstats
path: root/lib/log.cc
diff options
context:
space:
mode:
authorFritz Elfert <felfert@to.com>1999-07-04 12:00:07 +0000
committerFritz Elfert <felfert@to.com>1999-07-04 12:00:07 +0000
commit2b9c8881877dcb1835f17a0c5b642784c738049f (patch)
treed80f8469400d2d6bbfe396b68964de4d8bc59fda /lib/log.cc
parentf2d9bc87bc87b4ef3cdee081c65ad1c248804edd (diff)
downloadplptools-2b9c8881877dcb1835f17a0c5b642784c738049f.tar.gz
plptools-2b9c8881877dcb1835f17a0c5b642784c738049f.tar.bz2
plptools-2b9c8881877dcb1835f17a0c5b642784c738049f.zip
Initial import.
Diffstat (limited to 'lib/log.cc')
-rw-r--r--lib/log.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/log.cc b/lib/log.cc
new file mode 100644
index 0000000..7932e84
--- /dev/null
+++ b/lib/log.cc
@@ -0,0 +1,25 @@
+//#include <iostream.h>
+//#include <iomanip.h>
+
+#include "log.h"
+
+logbuf::logbuf(int _level) {
+ ptr = buf;
+ len = 0;
+ level = _level;
+}
+
+int logbuf::overflow(int c) {
+ if (c == '\n') {
+ *ptr++ = '\n';
+ *ptr = '\0';
+ syslog(level, buf);
+ ptr = buf;
+ return 0;
+ }
+ if ((len + 2) >= sizeof(buf))
+ return EOF;
+ *ptr++ = c;
+ len++;
+ return 0;
+}