OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/vlog.h" | 5 #include "base/vlog.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/string_split.h" | 10 #include "base/string_split.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 int* min_log_level) | 45 int* min_log_level) |
46 : min_log_level_(min_log_level) { | 46 : min_log_level_(min_log_level) { |
47 DCHECK(min_log_level != NULL); | 47 DCHECK(min_log_level != NULL); |
48 | 48 |
49 typedef std::pair<std::string, std::string> KVPair; | 49 typedef std::pair<std::string, std::string> KVPair; |
50 int vlog_level = 0; | 50 int vlog_level = 0; |
51 if (!v_switch.empty()) { | 51 if (!v_switch.empty()) { |
52 if (base::StringToInt(v_switch, &vlog_level)) { | 52 if (base::StringToInt(v_switch, &vlog_level)) { |
53 SetMaxVlogLevel(vlog_level); | 53 SetMaxVlogLevel(vlog_level); |
54 } else { | 54 } else { |
55 LOG(WARNING) << "Could not parse v switch \"" << v_switch << "\""; | 55 DLOG(WARNING) << "Could not parse v switch \"" << v_switch << "\""; |
56 } | 56 } |
57 } | 57 } |
58 | 58 |
59 std::vector<KVPair> kv_pairs; | 59 std::vector<KVPair> kv_pairs; |
60 if (!base::SplitStringIntoKeyValuePairs( | 60 if (!base::SplitStringIntoKeyValuePairs( |
61 vmodule_switch, '=', ',', &kv_pairs)) { | 61 vmodule_switch, '=', ',', &kv_pairs)) { |
62 LOG(WARNING) << "Could not fully parse vmodule switch \"" | 62 DLOG(WARNING) << "Could not fully parse vmodule switch \"" |
63 << vmodule_switch << "\""; | 63 << vmodule_switch << "\""; |
64 } | 64 } |
65 for (std::vector<KVPair>::const_iterator it = kv_pairs.begin(); | 65 for (std::vector<KVPair>::const_iterator it = kv_pairs.begin(); |
66 it != kv_pairs.end(); ++it) { | 66 it != kv_pairs.end(); ++it) { |
67 VmodulePattern pattern(it->first); | 67 VmodulePattern pattern(it->first); |
68 if (!base::StringToInt(it->second, &pattern.vlog_level)) { | 68 if (!base::StringToInt(it->second, &pattern.vlog_level)) { |
69 LOG(WARNING) << "Parsed vlog level for \"" | 69 DLOG(WARNING) << "Parsed vlog level for \"" |
70 << it->first << "=" << it->second | 70 << it->first << "=" << it->second |
71 << "\" as " << pattern.vlog_level; | 71 << "\" as " << pattern.vlog_level; |
72 } | 72 } |
73 vmodule_levels_.push_back(pattern); | 73 vmodule_levels_.push_back(pattern); |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 VlogInfo::~VlogInfo() {} | 77 VlogInfo::~VlogInfo() {} |
78 | 78 |
79 namespace { | 79 namespace { |
80 | 80 |
81 // Given a path, returns the basename with the extension chopped off | 81 // Given a path, returns the basename with the extension chopped off |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 if (MatchVlogPattern(s, p)) | 168 if (MatchVlogPattern(s, p)) |
169 return true; | 169 return true; |
170 s.remove_prefix(1); | 170 s.remove_prefix(1); |
171 } | 171 } |
172 | 172 |
173 // Otherwise, we couldn't find a match. | 173 // Otherwise, we couldn't find a match. |
174 return false; | 174 return false; |
175 } | 175 } |
176 | 176 |
177 } // namespace | 177 } // namespace |
OLD | NEW |