Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3521)

Unified Diff: third_party/leveldatabase/env_chromium.cc

Issue 11098057: Turn on LevelDB logging (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix comment Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/leveldatabase/chromium_logger.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/leveldatabase/env_chromium.cc
diff --git a/third_party/leveldatabase/env_chromium.cc b/third_party/leveldatabase/env_chromium.cc
index d1b4c26b53bce5582fcff1948dd725eb3d5f8f32..3088786f61b0e5c98b2618a22dc4d832c722689b 100644
--- a/third_party/leveldatabase/env_chromium.cc
+++ b/third_party/leveldatabase/env_chromium.cc
@@ -19,6 +19,7 @@
#include "base/threading/platform_thread.h"
#include "base/threading/thread.h"
#include "base/utf_string_conversions.h"
+#include "chromium_logger.h"
#include "leveldb/env.h"
#include "leveldb/slice.h"
#include "port/port.h"
@@ -423,22 +424,15 @@ class ChromiumEnv : public Env {
return Status::OK();
}
- class ChromiumLogger : public Logger {
- public:
- ChromiumLogger(const std::string& filename) : filename_(filename) {
- }
-
- virtual void Logv(const char* format, va_list ap) {
- VLOG(5) << "LevelDB: " << filename_ << " " << base::StringPrintV(format, ap);
- }
-
- private:
- std::string filename_;
- };
-
virtual Status NewLogger(const std::string& fname, Logger** result) {
- *result = new ChromiumLogger(fname);
- return Status::OK();
+ FILE* f = fopen_internal(fname.c_str(), "w");
+ if (f == NULL) {
+ *result = NULL;
+ return Status::IOError(fname, strerror(errno));
+ } else {
+ *result = new ChromiumLogger(f);
+ return Status::OK();
+ }
}
virtual uint64_t NowMicros() {
« no previous file with comments | « third_party/leveldatabase/chromium_logger.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698