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

Unified Diff: blimp/common/logging.h

Issue 2026053002: Blimp: change logger to use switch/case for types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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 | « blimp/client/feature/render_widget_feature.cc ('k') | blimp/common/logging.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/common/logging.h
diff --git a/blimp/common/logging.h b/blimp/common/logging.h
index 05fac3cd238d89a355845ba20be5e3425a3d9e93..9dd5dfd83d03fe4bf6342605acdfef57436935cf 100644
--- a/blimp/common/logging.h
+++ b/blimp/common/logging.h
@@ -5,60 +5,14 @@
#ifndef BLIMP_COMMON_LOGGING_H_
#define BLIMP_COMMON_LOGGING_H_
-#include <map>
-#include <memory>
-#include <string>
-#include <utility>
-#include <vector>
+#include <ostream>
#include "base/macros.h"
#include "blimp/common/blimp_common_export.h"
-#include "blimp/common/proto/blimp_message.pb.h"
namespace blimp {
class BlimpMessage;
-class LogExtractor;
-
-typedef std::vector<std::pair<std::string, std::string>> LogFields;
-
-// Defines an interface for classes that extract a set of loggable field
-// values from a message.
-class BLIMP_COMMON_EXPORT LogExtractor {
- public:
- virtual ~LogExtractor() {}
-
- // |message|: The message which is used for field extraction.
- // |output|: A vector of KV pairs which will receive the extracted fields.
- virtual void ExtractFields(const BlimpMessage& message,
- LogFields* output) const = 0;
-};
-
-// Registry of log extractors.
-class BLIMP_COMMON_EXPORT BlimpMessageLogger {
- public:
- BlimpMessageLogger();
- ~BlimpMessageLogger();
-
- // Formats the loggable representation of |message| and sends it to |out|.
- void LogMessageToStream(const BlimpMessage& message, std::ostream* out) const;
-
- private:
- // Adds |extractor| to the registry for parsing messages of type
- // |feature_case|.
- // |feature_name|: The human readable name of |feature_case|.
- void AddHandler(const std::string& feature_name,
- BlimpMessage::FeatureCase feature_case,
- std::unique_ptr<LogExtractor> extractor);
-
- // Registry of log extractors. Map structure is:
- // {message type => (human readable message type, LogExtractor*)}
- std::map<BlimpMessage::FeatureCase,
- std::pair<std::string, std::unique_ptr<LogExtractor>>>
- extractors_;
-
- DISALLOW_COPY_AND_ASSIGN(BlimpMessageLogger);
-};
// Serializes a BlimpMessage in a human-readable format for logging.
// An example message would look like:
« no previous file with comments | « blimp/client/feature/render_widget_feature.cc ('k') | blimp/common/logging.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698