proxygen
StandardLogHandlerFactory.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017-present Facebook, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #pragma once
17 
18 #include <string>
19 #include <unordered_map>
20 
21 #include <folly/Range.h>
22 
23 namespace folly {
24 
25 class LogWriter;
26 class LogFormatter;
27 class StandardLogHandler;
28 
36  public:
37  using Options = std::unordered_map<std::string, std::string>;
38 
40  public:
41  virtual ~OptionProcessor() {}
42 
51  virtual bool processOption(StringPiece name, StringPiece value) = 0;
52  };
53 
55  public:
56  virtual std::shared_ptr<LogFormatter> createFormatter(
57  const std::shared_ptr<LogWriter>& logWriter) = 0;
58  };
59 
60  class WriterFactory : public OptionProcessor {
61  public:
62  virtual std::shared_ptr<LogWriter> createWriter() = 0;
63  };
64 
65  static std::shared_ptr<StandardLogHandler> createHandler(
67  WriterFactory* writerFactory,
68  const Options& options);
69 };
70 
71 } // namespace folly
static std::shared_ptr< StandardLogHandler > createHandler(StringPiece type, WriterFactory *writerFactory, const Options &options)
PskType type
virtual bool processOption(StringPiece name, StringPiece value)=0
—— Concurrent Priority Queue Implementation ——
Definition: AtomicBitSet.h:29
const char * name
Definition: http_parser.c:437
std::unordered_map< std::string, std::string > Options
uint64_t value(const typename LockFreeRingBuffer< T, Atom >::Cursor &rbcursor)