diff options
Diffstat (limited to 'vespalog')
-rw-r--r-- | vespalog/src/logctl/logctl.cpp | 18 | ||||
-rw-r--r-- | vespalog/src/test/bufferedlogskiptest.cpp | 10 | ||||
-rw-r--r-- | vespalog/src/test/bufferedlogtest.cpp | 10 | ||||
-rw-r--r-- | vespalog/src/test/bufferedlogtest.logger1.cpp | 2 | ||||
-rw-r--r-- | vespalog/src/test/bufferedlogtest.logger2.cpp | 2 | ||||
-rw-r--r-- | vespalog/src/test/threads/testthreads.cpp | 2 | ||||
-rw-r--r-- | vespalog/src/vespa/log/bufferedlogger.cpp | 18 | ||||
-rw-r--r-- | vespalog/src/vespa/log/bufferedlogger.h | 2 | ||||
-rw-r--r-- | vespalog/src/vespa/log/log-target-file.cpp | 8 | ||||
-rw-r--r-- | vespalog/src/vespa/log/log-target.cpp | 4 | ||||
-rw-r--r-- | vespalog/src/vespa/log/log.cpp | 2 | ||||
-rw-r--r-- | vespalog/src/vespa/log/log.h | 5 |
12 files changed, 28 insertions, 55 deletions
diff --git a/vespalog/src/logctl/logctl.cpp b/vespalog/src/logctl/logctl.cpp index db3c84bd42f..2bae7c03589 100644 --- a/vespalog/src/logctl/logctl.cpp +++ b/vespalog/src/logctl/logctl.cpp @@ -1,20 +1,16 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <sys/types.h> -#include <cstdio> -#include <cstdlib> -#include <unistd.h> -#include <cstring> -#include <limits.h> - -#include <memory> -#include <vector> -#include <string> #include <vespa/defaults.h> #include <vespa/log/control-file.h> #include <vespa/log/internal.h> #include <vespa/log/component.h> -LOG_SETUP("vespa-logctl", "$Id$"); + +#include <unistd.h> +#include <dirent.h> +#include <sys/stat.h> + +LOG_SETUP("vespa-logctl"); + using namespace ns_log; diff --git a/vespalog/src/test/bufferedlogskiptest.cpp b/vespalog/src/test/bufferedlogskiptest.cpp index 5b386d18e90..cb16b73fa24 100644 --- a/vespalog/src/test/bufferedlogskiptest.cpp +++ b/vespalog/src/test/bufferedlogskiptest.cpp @@ -1,18 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/log/log.h> +#include <vespa/log/bufferedlogger.h> #include <fstream> #include <iostream> -#include <sstream> - -#include <sys/types.h> -#include <stdlib.h> #include <unistd.h> -#include <signal.h> -LOG_SETUP("bufferedlogskiptest", - "$Id$"); +LOG_SETUP("bufferedlogskiptest"); std::string readFile(const std::string& file) { std::ostringstream ost; diff --git a/vespalog/src/test/bufferedlogtest.cpp b/vespalog/src/test/bufferedlogtest.cpp index 0e27bd65988..97f70ebe004 100644 --- a/vespalog/src/test/bufferedlogtest.cpp +++ b/vespalog/src/test/bufferedlogtest.cpp @@ -1,21 +1,15 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/log/log.h> +#include <vespa/log/bufferedlogger.h> #include "bufferedlogtest.logger1.h" #include "bufferedlogtest.logger2.h" #include <fstream> #include <iostream> -#include <sstream> - -#include <sys/types.h> -#include <stdlib.h> #include <unistd.h> -#include <signal.h> -LOG_SETUP("bufferedlogtest", - "$Id$"); +LOG_SETUP("bufferedlogtest"); std::string readFile(const std::string& file) { std::ostringstream ost; diff --git a/vespalog/src/test/bufferedlogtest.logger1.cpp b/vespalog/src/test/bufferedlogtest.logger1.cpp index 992de19fea5..5af4b9489a4 100644 --- a/vespalog/src/test/bufferedlogtest.logger1.cpp +++ b/vespalog/src/test/bufferedlogtest.logger1.cpp @@ -1,6 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/log/log.h> +#include <vespa/log/bufferedlogger.h> #include "bufferedlogtest.logger1.h" LOG_SETUP(".logger1"); diff --git a/vespalog/src/test/bufferedlogtest.logger2.cpp b/vespalog/src/test/bufferedlogtest.logger2.cpp index 688ecd153aa..ac6935c2c68 100644 --- a/vespalog/src/test/bufferedlogtest.logger2.cpp +++ b/vespalog/src/test/bufferedlogtest.logger2.cpp @@ -1,6 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/log/log.h> +#include <vespa/log/bufferedlogger.h> #include "bufferedlogtest.logger2.h" LOG_SETUP(".logger2"); diff --git a/vespalog/src/test/threads/testthreads.cpp b/vespalog/src/test/threads/testthreads.cpp index 056f5aad2a2..90b8c13e497 100644 --- a/vespalog/src/test/threads/testthreads.cpp +++ b/vespalog/src/test/threads/testthreads.cpp @@ -2,7 +2,7 @@ #include <vespa/fastos/app.h> #include <vespa/fastos/time.h> #include <vespa/fastos/thread.h> -#include <vespa/log/log.h> +#include <vespa/log/bufferedlogger.h> #include <iostream> using std::string; diff --git a/vespalog/src/vespa/log/bufferedlogger.cpp b/vespalog/src/vespa/log/bufferedlogger.cpp index 30f3dcb648d..db2021324c3 100644 --- a/vespalog/src/vespa/log/bufferedlogger.cpp +++ b/vespalog/src/vespa/log/bufferedlogger.cpp @@ -1,14 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/log/bufferedlogger.h> - -#include <iomanip> -#include <iostream> -#include <sstream> -#include <vector> -#include <stdarg.h> -#include <sys/time.h> - +#include "bufferedlogger.h" +#include <vespa/fastos/mutex.h> #include <boost/multi_index_container.hpp> #include <boost/multi_index/identity.hpp> #include <boost/multi_index/member.hpp> @@ -16,6 +9,13 @@ #include <boost/multi_index/ordered_index.hpp> #include <boost/multi_index/sequenced_index.hpp> +#include <iomanip> +#include <iostream> +#include <sstream> +#include <vector> +#include <cstdarg> +#include <ctime> + namespace ns_log { // implementation details for BufferedLogger diff --git a/vespalog/src/vespa/log/bufferedlogger.h b/vespalog/src/vespa/log/bufferedlogger.h index 4f20f46af4c..9ab02f7842f 100644 --- a/vespalog/src/vespa/log/bufferedlogger.h +++ b/vespalog/src/vespa/log/bufferedlogger.h @@ -82,7 +82,6 @@ #define VESPA_LOG_LOGENTRYMAXAGE 300 // Max seconds an entry can be cached #define VESPA_LOG_COUNTAGEFACTOR 5 // How many seconds each count counts for -#include <vespa/fastos/mutex.h> #include <vespa/log/log.h> #include <sstream> #include <string> @@ -199,7 +198,6 @@ public: /** Trim the buffer. Removing old messages if wanted. */ void trimCache(); - }; } // ns_log diff --git a/vespalog/src/vespa/log/log-target-file.cpp b/vespalog/src/vespa/log/log-target-file.cpp index 07b638d7f84..e88f1018675 100644 --- a/vespalog/src/vespa/log/log-target-file.cpp +++ b/vespalog/src/vespa/log/log-target-file.cpp @@ -1,16 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <sys/types.h> #include <unistd.h> #include <cstring> -#include <sys/stat.h> #include <fcntl.h> -#include <cstdlib> -#include <errno.h> -#include <cstdio> +#include <cerrno> +#include <cassert> #include "log.h" LOG_SETUP(".log"); -LOG_RCSID("$Id$"); #include "log-target-file.h" #include "internal.h" diff --git a/vespalog/src/vespa/log/log-target.cpp b/vespalog/src/vespa/log/log-target.cpp index d34e0067b04..b6692caa308 100644 --- a/vespalog/src/vespa/log/log-target.cpp +++ b/vespalog/src/vespa/log/log-target.cpp @@ -1,11 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <sys/types.h> #include <cstring> -#include <cstdlib> +#include <cassert> #include "log.h" LOG_SETUP(".log"); -LOG_RCSID("$Id$"); #include "log-target-fd.h" #include "log-target-file.h" diff --git a/vespalog/src/vespa/log/log.cpp b/vespalog/src/vespa/log/log.cpp index 7e92008504e..c31d110d241 100644 --- a/vespalog/src/vespa/log/log.cpp +++ b/vespalog/src/vespa/log/log.cpp @@ -10,6 +10,7 @@ LOG_SETUP_INDIRECT(".log", "$Id$"); #include "log-target.h" #include "internal.h" #include "control-file.h" +#include "bufferedlogger.h" #include <vespa/fastos/thread.h> @@ -222,6 +223,7 @@ Logger::doLog(LogLevel level, const char *file, int line, const char *fmt, ...) actualSize = tryLog(sizeofPayload, level, file, line, fmt, args); va_end(args); } while (sizeofPayload < actualSize); + ns_log::BufferedLogger::logger.trimCache(); } void Logger::doLogCore(uint64_t timestamp, LogLevel level, diff --git a/vespalog/src/vespa/log/log.h b/vespalog/src/vespa/log/log.h index 6ecd69de792..53a0eec140c 100644 --- a/vespalog/src/vespa/log/log.h +++ b/vespalog/src/vespa/log/log.h @@ -38,14 +38,12 @@ static int log_dummmy __attribute__((unused)) = logger.setRcsId(x) do { \ if (logger.wants(ns_log::Logger::level)) { \ logger.doLog(ns_log::Logger::level, __FILE__, __LINE__, __VA_ARGS__); \ - ns_log::BufferedLogger::logger.trimCache(); \ } \ } while (0) #define VLOG(level, ...) \ do { \ if (logger.wants(level)) { \ logger.doLog(level, __FILE__, __LINE__, __VA_ARGS__); \ - ns_log::BufferedLogger::logger.trimCache(); \ } \ } while (0) #endif @@ -302,6 +300,3 @@ extern void log_abort(const char *message, #else #define LOG_ASSERT(expr) #endif // #ifndef NDEBUG - -#include <vespa/log/bufferedlogger.h> - |