1
#pragma once
2

            
3
#include <string>
4

            
5
#include "envoy/access_log/access_log.h"
6
#include "envoy/config/typed_config.h"
7
#include "envoy/formatter/substitution_formatter.h"
8
#include "envoy/server/filter_config.h"
9

            
10
#include "source/common/protobuf/protobuf.h"
11

            
12
namespace Envoy {
13
namespace AccessLog {
14

            
15
/**
16
 * Extension filter factory that reads from ExtensionFilter proto.
17
 */
18
class ExtensionFilterFactory : public Config::TypedFactory {
19
public:
20
  /**
21
   * Create a particular extension filter implementation from a config proto. If the
22
   * implementation is unable to produce a filter with the provided parameters, it should throw an
23
   * EnvoyException. The returned pointer should never be nullptr.
24
   * @param config supplies the custom configuration for this filter type.
25
   * @param context supplies the factory context.
26
   * @return an instance of extension filter implementation from a config proto.
27
   */
28
  virtual FilterPtr createFilter(const envoy::config::accesslog::v3::ExtensionFilter& config,
29
                                 Server::Configuration::GenericFactoryContext& context) PURE;
30

            
31
20
  std::string category() const override { return "envoy.access_loggers.extension_filters"; }
32
};
33

            
34
/**
35
 * Implemented for each AccessLog::Instance and registered via Registry::registerFactory or the
36
 * convenience class RegisterFactory.
37
 */
38
class AccessLogInstanceFactory : public Config::TypedFactory {
39
public:
40
  /**
41
   * Create a particular AccessLog::Instance implementation from a config proto. If the
42
   * implementation is unable to produce a factory with the provided parameters, it should throw an
43
   * EnvoyException. The returned pointer should never be nullptr.
44
   * @param config the custom configuration for this access log type.
45
   * @param filter filter to determine whether a particular request should be logged. If no filter
46
   * was specified in the configuration, argument will be nullptr.
47
   * @param context access log context through which persistent resources can be accessed.
48
   * @param command_parsers vector of command parsers that provide by the caller to be used for
49
   * parsing custom substitution commands.
50
   */
51
  virtual AccessLog::InstanceSharedPtr
52
  createAccessLogInstance(const Protobuf::Message& config, AccessLog::FilterPtr&& filter,
53
                          Server::Configuration::GenericFactoryContext& context,
54
                          std::vector<Formatter::CommandParserPtr>&& command_parsers = {}) PURE;
55

            
56
1057
  std::string category() const override { return "envoy.access_loggers"; }
57
};
58

            
59
} // namespace AccessLog
60
} // namespace Envoy