MongoDB C++ Driver  legacy-1.1.2
log_severity-inl.h
1 /* Copyright 2013 10gen 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 
16 #pragma once
17 
18 namespace mongo {
19 namespace logger {
20 
21 LogSeverity LogSeverity::Severe() {
22  return LogSeverity(-4);
23 }
24 LogSeverity LogSeverity::Error() {
25  return LogSeverity(-3);
26 }
27 LogSeverity LogSeverity::Warning() {
28  return LogSeverity(-2);
29 }
30 LogSeverity LogSeverity::Info() {
31  return LogSeverity(-1);
32 }
33 LogSeverity LogSeverity::Log() {
34  return LogSeverity(0);
35 }
36 LogSeverity LogSeverity::Debug(int debugLevel) {
37  return LogSeverity(debugLevel);
38 }
39 
41  return LogSeverity(ll);
42 }
43 
44 int LogSeverity::toInt() const {
45  return _severity;
46 }
48  return LogSeverity(_severity - 1);
49 }
51  return LogSeverity(_severity + 1);
52 }
53 
55  return _severity == other._severity;
56 }
58  return _severity != other._severity;
59 }
61  return _severity > other._severity;
62 }
64  return _severity >= other._severity;
65 }
67  return _severity < other._severity;
68 }
70  return _severity <= other._severity;
71 }
72 
73 } // namespace logger
74 } // namespace mongo
Utility functions for parsing numbers from strings.
Definition: compare_numbers.h:20
bool operator!=(const LogSeverity other) const
Returns true if this is not exactly as severe as other.
Definition: log_severity-inl.h:57
bool operator>=(const LogSeverity other) const
Returns true if this is no less severe than other.
Definition: log_severity-inl.h:69
LogSeverity lessSevere() const
Returns a LogSeverity object that is one unit "less severe" than this one.
Definition: log_severity-inl.h:50
static LogSeverity cast(int)
Casts an integer to a severity.
Definition: log_severity-inl.h:40
bool operator<(const LogSeverity other) const
Returns true if this is less severe than other.
Definition: log_severity-inl.h:60
bool operator==(const LogSeverity other) const
Returns true if this is exactly as severe as other.
Definition: log_severity-inl.h:54
LogSeverity moreSevere() const
Returns a LogSeverity object that is one unit "more severe" than this one.
Definition: log_severity-inl.h:47
bool operator>(const LogSeverity other) const
Returns true if this is more severe than other.
Definition: log_severity-inl.h:66
Representation of the severity / priority of a log message.
Definition: log_severity.h:33
bool operator<=(const LogSeverity other) const
Returns true if this is no more severe than other.
Definition: log_severity-inl.h:63