OLD | NEW |
| (Empty) |
1 // Copyright (C) 2011 Google Inc. | |
2 // | |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | |
4 // you may not use this file except in compliance with the License. | |
5 // You may obtain a copy of the License at | |
6 // | |
7 // http://www.apache.org/licenses/LICENSE-2.0 | |
8 // | |
9 // Unless required by applicable law or agreed to in writing, software | |
10 // distributed under the License is distributed on an "AS IS" BASIS, | |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 // See the License for the specific language governing permissions and | |
13 // limitations under the License. | |
14 | |
15 // Author: Philippe Liard | |
16 | |
17 #include <iostream> | |
18 | |
19 #include "default_logger.h" | |
20 | |
21 using std::cerr; | |
22 using std::cout; | |
23 using std::endl; | |
24 | |
25 namespace i18n { | |
26 namespace phonenumbers { | |
27 | |
28 DefaultLogger::DefaultLogger(LogLevel level) : level_(level) {} | |
29 | |
30 DefaultLogger::~DefaultLogger() {} | |
31 | |
32 void DefaultLogger::Fatal(const string& msg) const { | |
33 if (level_ >= LOG_FATAL) { | |
34 cerr << "FATAL libphonenumber " << msg << endl; | |
35 } | |
36 } | |
37 | |
38 void DefaultLogger::Error(const string& msg) const { | |
39 if (level_ >= LOG_ERROR) { | |
40 cerr << "ERROR libphonenumber " << msg << endl; | |
41 } | |
42 } | |
43 | |
44 void DefaultLogger::Warning(const string& msg) const { | |
45 if (level_ >= LOG_WARNING) { | |
46 cerr << "WARNING libphonenumber " << msg << endl; | |
47 } | |
48 } | |
49 | |
50 void DefaultLogger::Info(const string& msg) const { | |
51 if (level_ >= LOG_INFO) { | |
52 cout << "INFO libphonenumber " << msg << endl; | |
53 } | |
54 } | |
55 | |
56 void DefaultLogger::Debug(const string& msg) const { | |
57 if (level_ >= LOG_DEBUG) { | |
58 cout << "DEBUG libphonenumber " << msg << endl; | |
59 } | |
60 } | |
61 | |
62 } // namespace phonenumbers | |
63 } // namespace i18n | |
OLD | NEW |