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

Unified Diff: base/vlog.cc

Issue 4164011: Integrate ETW with VLOG logging. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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 | « base/vlog.h ('k') | base/vlog_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/vlog.cc
===================================================================
--- base/vlog.cc (revision 65044)
+++ base/vlog.cc (working copy)
@@ -29,14 +29,20 @@
match_target(MATCH_MODULE) {}
VlogInfo::VlogInfo(const std::string& v_switch,
- const std::string& vmodule_switch)
- : max_vlog_level_(kDefaultVlogLevel) {
+ const std::string& vmodule_switch,
+ int* min_log_level)
+ : min_log_level_(min_log_level) {
+ DCHECK(min_log_level != NULL);
+
typedef std::pair<std::string, std::string> KVPair;
- if (!v_switch.empty() &&
- !base::StringToInt(v_switch, &max_vlog_level_)) {
+ int vlog_level = 0;
+ if (base::StringToInt(v_switch, &vlog_level)) {
+ SetMaxVlogLevel(vlog_level);
+ } else {
LOG(WARNING) << "Parsed v switch \""
- << v_switch << "\" as " << max_vlog_level_;
+ << v_switch << "\" as " << vlog_level;
}
+
std::vector<KVPair> kv_pairs;
if (!base::SplitStringIntoKeyValuePairs(
vmodule_switch, '=', ',', &kv_pairs)) {
@@ -57,6 +63,15 @@
VlogInfo::~VlogInfo() {}
+void VlogInfo::SetMaxVlogLevel(int level) {
+ // Log severity is the negative verbosity.
+ *min_log_level_ = -level;
+}
+
+int VlogInfo::GetMaxVlogLevel() const {
+ return -*min_log_level_;
+}
+
namespace {
// Given a path, returns the basename with the extension chopped off
@@ -79,7 +94,7 @@
} // namespace
-int VlogInfo::GetVlogLevel(const base::StringPiece& file) {
+int VlogInfo::GetVlogLevel(const base::StringPiece& file) const {
if (!vmodule_levels_.empty()) {
base::StringPiece module(GetModule(file));
for (std::vector<VmodulePattern>::const_iterator it =
@@ -90,7 +105,7 @@
return it->vlog_level;
}
}
- return max_vlog_level_;
+ return GetMaxVlogLevel();
}
bool MatchVlogPattern(const base::StringPiece& string,
Property changes on: base\vlog.cc
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « base/vlog.h ('k') | base/vlog_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698