@@ -36,16 +36,16 @@ namespace trpc::cls {
3636// / @brief Set the plugin ID for a given logger name.
3737// / @param logger_name The name of the logger.
3838// / @param plugin_id The ID of the plugin associated with the logger.
39- void SetLoggerPlunginId (const std::string& logger_name, uint32_t plugin_id);
39+ void SetLoggerPluginId (const std::string& logger_name, uint32_t plugin_id);
4040
4141// / @brief Get the plugin ID associated with a given logger name.
4242// / @param logger_name The name of the logger.
4343// / @return The plugin ID associated with the logger name.
44- uint32_t GetPlunginIdFromLogger (const std::string& logger_name);
44+ uint32_t GetPluginIdFromLogger (const std::string& logger_name);
4545
4646// / @brief Get the map of logger names to plugin IDs.
4747// / @return A reference to the unordered_map containing logger names as keys and plugin IDs as values.
48- std::unordered_map<std::string, uint32_t >& GetLoggerPlunginIdMap ();
48+ std::unordered_map<std::string, uint32_t >& GetLoggerPluginIdMap ();
4949
5050// / @brief Adds key-value pairs to the context's filter data for each logger plugin.
5151// / @tparam T The type of the context object.
@@ -63,14 +63,14 @@ std::unordered_map<std::string, uint32_t>& GetLoggerPlunginIdMap();
6363// / @endcode
6464template <typename T, typename ... Args>
6565void WithFields (T& context, Args&&... key_value_pairs) {
66- auto plugin_id_map = GetLoggerPlunginIdMap ();
66+ auto plugin_id_map = GetLoggerPluginIdMap ();
6767 for (const auto & [logger_name, plugin_id] : plugin_id_map) {
6868 auto * data_map = context->template GetFilterData <std::unordered_map<std::string, std::string>>(
69- GetPlunginIdFromLogger (logger_name.c_str ()));
69+ GetPluginIdFromLogger (logger_name.c_str ()));
7070 if (!data_map) {
7171 std::unordered_map<std::string, std::string> new_data_map;
7272 (new_data_map.emplace (std::forward<Args>(key_value_pairs)), ...);
73- context->SetFilterData (GetPlunginIdFromLogger (logger_name.c_str ()), std::move (new_data_map));
73+ context->SetFilterData (GetPluginIdFromLogger (logger_name.c_str ()), std::move (new_data_map));
7474 } else {
7575 (data_map->emplace (std::forward<Args>(key_value_pairs)), ...);
7676 }
@@ -79,11 +79,11 @@ void WithFields(T& context, Args&&... key_value_pairs) {
7979
8080class ClsLog : public Logging {
8181 public:
82- std::string Name () const { return " cls-log" ; }
82+ std::string Name () const override { return " cls-log" ; }
8383
84- std::string LoggerName () const { return logger_name_; }
84+ const std::string& LoggerName () const override { return logger_name_; }
8585
86- std::string Version () const { return " 1.0.0" ; }
86+ std::string Version () const { return " 1.0.0" ; }
8787
8888 explicit ClsLog (const ClsLogSinkConfig& sink_config)
8989 : logger_name_(sink_config.logger_name),
@@ -92,7 +92,7 @@ class ClsLog : public Logging {
9292 endpoint_(sink_config.endpoint),
9393 secret_id_(sink_config.secret_id),
9494 secret_key_(sink_config.secret_key) {
95- SetLoggerPlunginId (logger_name_, this ->GetPluginID ());
95+ SetLoggerPluginId (logger_name_, this ->GetPluginID ());
9696 Init ();
9797 }
9898
@@ -154,10 +154,10 @@ class ClsLog : public Logging {
154154
155155 private:
156156 // Initialize the CLS SDK
157- void initSDK ();
157+ void InitSDK ();
158158
159159 // Initialize the spdlog logger instance
160- bool initSpdLogger ();
160+ bool InitSpdLogger ();
161161
162162 private:
163163 // logger configuration
@@ -181,4 +181,4 @@ class ClsLog : public Logging {
181181
182182using ClsLogPtr = RefPtr<ClsLog>;
183183
184- } // namespace trpc::cls
184+ } // namespace trpc::cls
0 commit comments