MongoDB C++ Driver  legacy-1.1.2
log_component.h
1 /* Copyright 2014 MongoDB 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 #include <iosfwd>
19 #include <string>
20 
21 #include "mongo/base/string_data.h"
22 #include "mongo/client/export_macros.h"
23 
24 namespace mongo {
25 namespace logger {
26 
32 class MONGO_CLIENT_API LogComponent {
33 public:
34  enum Value {
35  kDefault = 0,
36  kAccessControl,
37  kCommand,
38  kControl,
39  kGeo,
40  kIndex,
41  kNetwork,
42  kQuery,
43  kReplication,
44  kSharding,
45  kStorage,
46  kJournal,
47  kWrite,
48  kNumLogComponents
49  };
50 
51  /* implicit */ LogComponent(Value value) : _value(value) {}
52 
53  operator Value() const {
54  return _value;
55  }
56 
62  LogComponent parent() const;
63 
67  StringData toStringData() const;
68 
73  std::string getShortName() const;
74 
80  std::string getDottedName() const;
81 
87  StringData getNameForLog() const;
88 
89 private:
90  Value _value;
91 };
92 
93 MONGO_CLIENT_API std::ostream& MONGO_CLIENT_FUNC
94 operator<<(std::ostream& os, LogComponent component);
95 
96 } // namespace logger
97 } // namespace mongo
Log components.
Definition: log_component.h:32
A StringData object wraps a 'const string&' or a 'const char*' without copying its contents...
Definition: string_data.h:43
Utility functions for parsing numbers from strings.
Definition: compare_numbers.h:20