Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/TamTamJam.activity/common/Util/Clooper/log.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TamTamJam.activity/common/Util/Clooper/log.cpp')
-rw-r--r--TamTamJam.activity/common/Util/Clooper/log.cpp52
1 files changed, 0 insertions, 52 deletions
diff --git a/TamTamJam.activity/common/Util/Clooper/log.cpp b/TamTamJam.activity/common/Util/Clooper/log.cpp
deleted file mode 100644
index d4a8c72..0000000
--- a/TamTamJam.activity/common/Util/Clooper/log.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-#ifndef LOG_HXX
-#define LOG_HXX
-
-#include <stdarg.h>
-#include <stdio.h>
-
-struct log_t
-{
- FILE * _file;
- int _level;
- int _close;
-
- log_t(const char * logpath, int level = 0) : _file(NULL), _level(level), _close(1)
- {
- _file = fopen(logpath, "w");
- if (!_file)
- {
- fprintf(stderr, "Failed to open log file for writing: %s\n", logpath);
- }
- }
- log_t(FILE * file, int level = 0): _file(file), _level(level), _close(0)
- {
- }
- ~log_t()
- {
- if (_close && _file) fclose(_file);
- }
- void printf( const char * fmt, ... ) __attribute__(( format (printf, 2,3)))
- {
- if (!_file) return;
- va_list ap;
- va_start(ap,fmt);
- ::vfprintf(_file, fmt, ap);
- va_end(ap);
- fflush(_file);
- }
- void printf( int level, const char * fmt, ... ) __attribute__(( format (printf, 3,4)))
- {
- if (level <= _level)
- {
- if (!_file) return;
- fprintf(_file, "L%i:", level);
- va_list ap;
- va_start(ap,fmt);
- ::vfprintf(_file, fmt, ap);
- va_end(ap);
- fflush(_file);
- }
- }
-};
-
-#endif