Line | Count | Source |
1 | | // Licensed to the Apache Software Foundation (ASF) under one |
2 | | // or more contributor license agreements. See the NOTICE file |
3 | | // distributed with this work for additional information |
4 | | // regarding copyright ownership. The ASF licenses this file |
5 | | // to you under the Apache License, Version 2.0 (the |
6 | | // "License"); you may not use this file except in compliance |
7 | | // with the License. You may obtain a copy of the License at |
8 | | // |
9 | | // http://www.apache.org/licenses/LICENSE-2.0 |
10 | | // |
11 | | // Unless required by applicable law or agreed to in writing, |
12 | | // software distributed under the License is distributed on an |
13 | | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
14 | | // KIND, either express or implied. See the License for the |
15 | | // specific language governing permissions and limitations |
16 | | // under the License. |
17 | | |
18 | | #pragma once |
19 | | |
20 | | #include <memory> |
21 | | |
22 | | // GLOG defines this based on the system but doesn't check if it's already |
23 | | // been defined. undef it first to avoid warnings. |
24 | | // glog MUST be included before gflags. Instead of including them, |
25 | | // our files should include this file instead. |
26 | | #undef _XOPEN_SOURCE |
27 | | // This is including a glog internal file. We want this to expose the |
28 | | // function to get the stack trace. |
29 | | #include <glog/logging.h> // IWYU pragma: export |
30 | | #undef MutexLock |
31 | | |
32 | | // Define VLOG levels. We want display per-row info less than per-file which |
33 | | // is less than per-query. For now per-connection is the same as per-query. |
34 | | #define VLOG_CONNECTION VLOG(1) |
35 | 18.4E | #define VLOG_RPC VLOG(8) |
36 | 18.4E | #define VLOG_QUERY VLOG(1) |
37 | 18.4E | #define VLOG_FILE VLOG(2) |
38 | 18.4E | #define VLOG_ROW VLOG(10) |
39 | 0 | #define VLOG_PROGRESS VLOG(2) |
40 | 18.4E | #define VLOG_TRACE VLOG(10) |
41 | 18.4E | #define VLOG_DEBUG VLOG(7) |
42 | 74.1k | #define VLOG_NOTICE VLOG(3) |
43 | 18.4E | #define VLOG_CRITICAL VLOG(1) |
44 | | |
45 | | #define VLOG_CONNECTION_IS_ON VLOG_IS_ON(1) |
46 | | #define VLOG_RPC_IS_ON VLOG_IS_ON(8) |
47 | | #define VLOG_QUERY_IS_ON VLOG_IS_ON(1) |
48 | 3.43k | #define VLOG_FILE_IS_ON VLOG_IS_ON(2) |
49 | | #define VLOG_ROW_IS_ON VLOG_IS_ON(10) |
50 | 1.11M | #define VLOG_TRACE_IS_ON VLOG_IS_ON(10) |
51 | 79.9k | #define VLOG_DEBUG_IS_ON VLOG_IS_ON(7) |
52 | | #define VLOG_NOTICE_IS_ON VLOG_IS_ON(3) |
53 | 0 | #define VLOG_CRITICAL_IS_ON VLOG_IS_ON(1) |
54 | | |
55 | | /// Define a wrapper around DCHECK for strongly typed enums that print a useful error |
56 | | /// message on failure. |
57 | | #define DCHECK_ENUM_EQ(a, b) \ |
58 | | DCHECK(a == b) << "[ " #a " = " << static_cast<int>(a) << " , " #b " = " \ |
59 | | << static_cast<int>(b) << " ]" |
60 | | |
61 | | #include <fmt/format.h> |
62 | | |
63 | | #include <string> |
64 | | |
65 | | namespace doris { |
66 | | |
67 | | // TaggableLogger::tag only needs these declarations; TUs that actually log a |
68 | | // TUniqueId/PUniqueId have the full types from their own includes. |
69 | | class TUniqueId; |
70 | | class PUniqueId; |
71 | | std::string print_id(const TUniqueId& id); |
72 | | std::string print_id(const PUniqueId& id); |
73 | | |
74 | | // glog doesn't allow multiple invocations of InitGoogleLogging. This method conditionally |
75 | | // calls InitGoogleLogging only if it hasn't been called before. |
76 | | bool init_glog(const char* basename); |
77 | | |
78 | | // Shuts down the google logging library. Call before exit to ensure that log files are |
79 | | // flushed. May only be called once. |
80 | | void shutdown_logging(); |
81 | | |
82 | | void update_logging(const std::string& name, const std::string& value); |
83 | | |
84 | | class TaggableLogger { |
85 | | public: |
86 | | TaggableLogger(const char* file, int line, google::LogSeverity severity) |
87 | 1.10M | : _msg(file, line, severity) {} |
88 | | |
89 | | template <typename... Args> |
90 | 1.10M | TaggableLogger& operator()(const std::string_view& fmt, Args&&... args) { |
91 | 1.10M | if constexpr (sizeof...(args) == 0) { |
92 | 517k | _msg.stream() << fmt; |
93 | 584k | } else { |
94 | 584k | _msg.stream() << fmt::format(fmt, std::forward<Args&&>(args)...); |
95 | 584k | } |
96 | 1.10M | return *this; |
97 | 1.10M | } _ZN5doris14TaggableLoggerclIJRSt17basic_string_viewIcSt11char_traitsIcEEEEERS0_RKS5_DpOT_ Line | Count | Source | 90 | 20.2k | TaggableLogger& operator()(const std::string_view& fmt, Args&&... args) { | 91 | | if constexpr (sizeof...(args) == 0) { | 92 | | _msg.stream() << fmt; | 93 | 20.2k | } else { | 94 | 20.2k | _msg.stream() << fmt::format(fmt, std::forward<Args&&>(args)...); | 95 | 20.2k | } | 96 | 20.2k | return *this; | 97 | 20.2k | } |
_ZN5doris14TaggableLoggerclIJEEERS0_RKSt17basic_string_viewIcSt11char_traitsIcEEDpOT_ Line | Count | Source | 90 | 517k | TaggableLogger& operator()(const std::string_view& fmt, Args&&... args) { | 91 | 517k | if constexpr (sizeof...(args) == 0) { | 92 | 517k | _msg.stream() << fmt; | 93 | | } else { | 94 | | _msg.stream() << fmt::format(fmt, std::forward<Args&&>(args)...); | 95 | | } | 96 | 517k | return *this; | 97 | 517k | } |
_ZN5doris14TaggableLoggerclIJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEERS0_RKSt17basic_string_viewIcS5_EDpOT_ Line | Count | Source | 90 | 82.5k | TaggableLogger& operator()(const std::string_view& fmt, Args&&... args) { | 91 | | if constexpr (sizeof...(args) == 0) { | 92 | | _msg.stream() << fmt; | 93 | 82.5k | } else { | 94 | 82.5k | _msg.stream() << fmt::format(fmt, std::forward<Args&&>(args)...); | 95 | 82.5k | } | 96 | 82.5k | return *this; | 97 | 82.5k | } |
_ZN5doris14TaggableLoggerclIJRmRhEEERS0_RKSt17basic_string_viewIcSt11char_traitsIcEEDpOT_ Line | Count | Source | 90 | 3 | TaggableLogger& operator()(const std::string_view& fmt, Args&&... args) { | 91 | | if constexpr (sizeof...(args) == 0) { | 92 | | _msg.stream() << fmt; | 93 | 3 | } else { | 94 | 3 | _msg.stream() << fmt::format(fmt, std::forward<Args&&>(args)...); | 95 | 3 | } | 96 | 3 | return *this; | 97 | 3 | } |
_ZN5doris14TaggableLoggerclIJRmRKhEEERS0_RKSt17basic_string_viewIcSt11char_traitsIcEEDpOT_ Line | Count | Source | 90 | 3 | TaggableLogger& operator()(const std::string_view& fmt, Args&&... args) { | 91 | | if constexpr (sizeof...(args) == 0) { | 92 | | _msg.stream() << fmt; | 93 | 3 | } else { | 94 | 3 | _msg.stream() << fmt::format(fmt, std::forward<Args&&>(args)...); | 95 | 3 | } | 96 | 3 | return *this; | 97 | 3 | } |
Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERiS7_EEERS0_RKSt17basic_string_viewIcS5_EDpOT_ _ZN5doris14TaggableLoggerclIJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_EEERS0_RKSt17basic_string_viewIcS5_EDpOT_ Line | Count | Source | 90 | 1 | TaggableLogger& operator()(const std::string_view& fmt, Args&&... args) { | 91 | | if constexpr (sizeof...(args) == 0) { | 92 | | _msg.stream() << fmt; | 93 | 1 | } else { | 94 | 1 | _msg.stream() << fmt::format(fmt, std::forward<Args&&>(args)...); | 95 | 1 | } | 96 | 1 | return *this; | 97 | 1 | } |
_ZN5doris14TaggableLoggerclIJRlS2_S2_RmEEERS0_RKSt17basic_string_viewIcSt11char_traitsIcEEDpOT_ Line | Count | Source | 90 | 99 | TaggableLogger& operator()(const std::string_view& fmt, Args&&... args) { | 91 | | if constexpr (sizeof...(args) == 0) { | 92 | | _msg.stream() << fmt; | 93 | 99 | } else { | 94 | 99 | _msg.stream() << fmt::format(fmt, std::forward<Args&&>(args)...); | 95 | 99 | } | 96 | 99 | return *this; | 97 | 99 | } |
Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERiS8_S9_RjRlSB_SB_EEERS0_RKSt17basic_string_viewIcS5_EDpOT_ Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERjRlS9_S9_EEERS0_RKSt17basic_string_viewIcS5_EDpOT_ _ZN5doris14TaggableLoggerclIJRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERiRlSA_lRjSA_SA_SA_EEERS0_RKSt17basic_string_viewIcS5_EDpOT_ Line | Count | Source | 90 | 99 | TaggableLogger& operator()(const std::string_view& fmt, Args&&... args) { | 91 | | if constexpr (sizeof...(args) == 0) { | 92 | | _msg.stream() << fmt; | 93 | 99 | } else { | 94 | 99 | _msg.stream() << fmt::format(fmt, std::forward<Args&&>(args)...); | 95 | 99 | } | 96 | 99 | return *this; | 97 | 99 | } |
Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJRlS2_S2_RNS_6StatusEEEERS0_RKSt17basic_string_viewIcSt11char_traitsIcEEDpOT_ _ZN5doris14TaggableLoggerclIJRlS2_S2_S2_RKmEEERS0_RKSt17basic_string_viewIcSt11char_traitsIcEEDpOT_ Line | Count | Source | 90 | 99 | TaggableLogger& operator()(const std::string_view& fmt, Args&&... args) { | 91 | | if constexpr (sizeof...(args) == 0) { | 92 | | _msg.stream() << fmt; | 93 | 99 | } else { | 94 | 99 | _msg.stream() << fmt::format(fmt, std::forward<Args&&>(args)...); | 95 | 99 | } | 96 | 99 | return *this; | 97 | 99 | } |
Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJlNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEERS0_RKSt17basic_string_viewIcS5_EDpOT_ Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJRdNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEimEEERS0_RKSt17basic_string_viewIcS6_EDpOT_ Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERiRNS_6StatusEEEERS0_RKSt17basic_string_viewIcS5_EDpOT_ Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERiEEERS0_RKSt17basic_string_viewIcS5_EDpOT_ _ZN5doris14TaggableLoggerclIJRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERiS8_EEERS0_RKSt17basic_string_viewIcS5_EDpOT_ Line | Count | Source | 90 | 1 | TaggableLogger& operator()(const std::string_view& fmt, Args&&... args) { | 91 | | if constexpr (sizeof...(args) == 0) { | 92 | | _msg.stream() << fmt; | 93 | 1 | } else { | 94 | 1 | _msg.stream() << fmt::format(fmt, std::forward<Args&&>(args)...); | 95 | 1 | } | 96 | 1 | return *this; | 97 | 1 | } |
_ZN5doris14TaggableLoggerclIJRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKS7_EEERS0_RKSt17basic_string_viewIcS5_EDpOT_ Line | Count | Source | 90 | 2 | TaggableLogger& operator()(const std::string_view& fmt, Args&&... args) { | 91 | | if constexpr (sizeof...(args) == 0) { | 92 | | _msg.stream() << fmt; | 93 | 2 | } else { | 94 | 2 | _msg.stream() << fmt::format(fmt, std::forward<Args&&>(args)...); | 95 | 2 | } | 96 | 2 | return *this; | 97 | 2 | } |
_ZN5doris14TaggableLoggerclIJRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEERS0_RKSt17basic_string_viewIcS5_EDpOT_ Line | Count | Source | 90 | 1 | TaggableLogger& operator()(const std::string_view& fmt, Args&&... args) { | 91 | | if constexpr (sizeof...(args) == 0) { | 92 | | _msg.stream() << fmt; | 93 | 1 | } else { | 94 | 1 | _msg.stream() << fmt::format(fmt, std::forward<Args&&>(args)...); | 95 | 1 | } | 96 | 1 | return *this; | 97 | 1 | } |
_ZN5doris14TaggableLoggerclIJRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKS7_lEEERS0_RKSt17basic_string_viewIcS5_EDpOT_ Line | Count | Source | 90 | 11 | TaggableLogger& operator()(const std::string_view& fmt, Args&&... args) { | 91 | | if constexpr (sizeof...(args) == 0) { | 92 | | _msg.stream() << fmt; | 93 | 11 | } else { | 94 | 11 | _msg.stream() << fmt::format(fmt, std::forward<Args&&>(args)...); | 95 | 11 | } | 96 | 11 | return *this; | 97 | 11 | } |
Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJRiEEERS0_RKSt17basic_string_viewIcSt11char_traitsIcEEDpOT_ Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_EEERS0_RKSt17basic_string_viewIcS5_EDpOT_ _ZN5doris14TaggableLoggerclIJRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERmS7_EEERS0_RKSt17basic_string_viewIcS5_EDpOT_ Line | Count | Source | 90 | 1 | TaggableLogger& operator()(const std::string_view& fmt, Args&&... args) { | 91 | | if constexpr (sizeof...(args) == 0) { | 92 | | _msg.stream() << fmt; | 93 | 1 | } else { | 94 | 1 | _msg.stream() << fmt::format(fmt, std::forward<Args&&>(args)...); | 95 | 1 | } | 96 | 1 | return *this; | 97 | 1 | } |
_ZN5doris14TaggableLoggerclIJRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERmSA_EEERS0_RKSt17basic_string_viewIcS5_EDpOT_ Line | Count | Source | 90 | 1 | TaggableLogger& operator()(const std::string_view& fmt, Args&&... args) { | 91 | | if constexpr (sizeof...(args) == 0) { | 92 | | _msg.stream() << fmt; | 93 | 1 | } else { | 94 | 1 | _msg.stream() << fmt::format(fmt, std::forward<Args&&>(args)...); | 95 | 1 | } | 96 | 1 | return *this; | 97 | 1 | } |
Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJNS_6StatusEEEERS0_RKSt17basic_string_viewIcSt11char_traitsIcEEDpOT_ Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERmSA_lRKbEEERS0_RKSt17basic_string_viewIcS5_EDpOT_ _ZN5doris14TaggableLoggerclIJRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEERS0_RKSt17basic_string_viewIcS5_EDpOT_ Line | Count | Source | 90 | 262 | TaggableLogger& operator()(const std::string_view& fmt, Args&&... args) { | 91 | | if constexpr (sizeof...(args) == 0) { | 92 | | _msg.stream() << fmt; | 93 | 262 | } else { | 94 | 262 | _msg.stream() << fmt::format(fmt, std::forward<Args&&>(args)...); | 95 | 262 | } | 96 | 262 | return *this; | 97 | 262 | } |
Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJRKmEEERS0_RKSt17basic_string_viewIcSt11char_traitsIcEEDpOT_ _ZN5doris14TaggableLoggerclIJRdS2_EEERS0_RKSt17basic_string_viewIcSt11char_traitsIcEEDpOT_ Line | Count | Source | 90 | 1 | TaggableLogger& operator()(const std::string_view& fmt, Args&&... args) { | 91 | | if constexpr (sizeof...(args) == 0) { | 92 | | _msg.stream() << fmt; | 93 | 1 | } else { | 94 | 1 | _msg.stream() << fmt::format(fmt, std::forward<Args&&>(args)...); | 95 | 1 | } | 96 | 1 | return *this; | 97 | 1 | } |
_ZN5doris14TaggableLoggerclIJRlS2_S2_NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEERS0_RKSt17basic_string_viewIcS6_EDpOT_ Line | Count | Source | 90 | 32 | TaggableLogger& operator()(const std::string_view& fmt, Args&&... args) { | 91 | | if constexpr (sizeof...(args) == 0) { | 92 | | _msg.stream() << fmt; | 93 | 32 | } else { | 94 | 32 | _msg.stream() << fmt::format(fmt, std::forward<Args&&>(args)...); | 95 | 32 | } | 96 | 32 | return *this; | 97 | 32 | } |
Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJRlNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES2_S8_EEERS0_RKSt17basic_string_viewIcS6_EDpOT_ Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJRlNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEERS0_RKSt17basic_string_viewIcS6_EDpOT_ Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJlNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_EEERS0_RKSt17basic_string_viewIcS5_EDpOT_ Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJRKlEEERS0_RKSt17basic_string_viewIcSt11char_traitsIcEEDpOT_ Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJRlS2_S2_EEERS0_RKSt17basic_string_viewIcSt11char_traitsIcEEDpOT_ Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJRSt17basic_string_viewIcSt11char_traitsIcEEmEEERS0_RKS5_DpOT_ Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJRlEEERS0_RKSt17basic_string_viewIcSt11char_traitsIcEEDpOT_ _ZN5doris14TaggableLoggerclIJlEEERS0_RKSt17basic_string_viewIcSt11char_traitsIcEEDpOT_ Line | Count | Source | 90 | 1.16k | TaggableLogger& operator()(const std::string_view& fmt, Args&&... args) { | 91 | | if constexpr (sizeof...(args) == 0) { | 92 | | _msg.stream() << fmt; | 93 | 1.16k | } else { | 94 | 1.16k | _msg.stream() << fmt::format(fmt, std::forward<Args&&>(args)...); | 95 | 1.16k | } | 96 | 1.16k | return *this; | 97 | 1.16k | } |
_ZN5doris14TaggableLoggerclIJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERlRS7_EEERS0_RKSt17basic_string_viewIcS5_EDpOT_ Line | Count | Source | 90 | 336k | TaggableLogger& operator()(const std::string_view& fmt, Args&&... args) { | 91 | | if constexpr (sizeof...(args) == 0) { | 92 | | _msg.stream() << fmt; | 93 | 336k | } else { | 94 | 336k | _msg.stream() << fmt::format(fmt, std::forward<Args&&>(args)...); | 95 | 336k | } | 96 | 336k | return *this; | 97 | 336k | } |
Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPKcEEERS0_RKSt17basic_string_viewIcS5_EDpOT_ Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPKcEEERS0_RKSt17basic_string_viewIcS5_EDpOT_ Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_EEERS0_RKSt17basic_string_viewIcS5_EDpOT_ _ZN5doris14TaggableLoggerclIJRmRiEEERS0_RKSt17basic_string_viewIcSt11char_traitsIcEEDpOT_ Line | Count | Source | 90 | 7 | TaggableLogger& operator()(const std::string_view& fmt, Args&&... args) { | 91 | | if constexpr (sizeof...(args) == 0) { | 92 | | _msg.stream() << fmt; | 93 | 7 | } else { | 94 | 7 | _msg.stream() << fmt::format(fmt, std::forward<Args&&>(args)...); | 95 | 7 | } | 96 | 7 | return *this; | 97 | 7 | } |
Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJPKcEEERS0_RKSt17basic_string_viewIcSt11char_traitsIcEEDpOT_ Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJRlS2_EEERS0_RKSt17basic_string_viewIcSt11char_traitsIcEEDpOT_ Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEKS7_EEERS0_RKSt17basic_string_viewIcS5_EDpOT_ Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERiS7_EEERS0_RKSt17basic_string_viewIcS5_EDpOT_ _ZN5doris14TaggableLoggerclIJmNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERdEEERS0_RKSt17basic_string_viewIcS5_EDpOT_ Line | Count | Source | 90 | 18 | TaggableLogger& operator()(const std::string_view& fmt, Args&&... args) { | 91 | | if constexpr (sizeof...(args) == 0) { | 92 | | _msg.stream() << fmt; | 93 | 18 | } else { | 94 | 18 | _msg.stream() << fmt::format(fmt, std::forward<Args&&>(args)...); | 95 | 18 | } | 96 | 18 | return *this; | 97 | 18 | } |
Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJRKNS_15TObjStorageType4typeENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEERS0_RKSt17basic_string_viewIcS9_EDpOT_ Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJNS_5cloud26ObjectStoreInfoPB_ProviderENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEERS0_RKSt17basic_string_viewIcS7_EDpOT_ unity_2_cxx.cxx:_ZN5doris14TaggableLoggerclIJmRllRPKcN3fmt2v78arg_joinINSt6ranges14transform_viewINS9_8ref_viewISt6vectorISt10shared_ptrINS_6RowsetEESaISF_EEEEZNS_11CloudTablet41replace_rowsets_with_schema_change_outputERKSH_lRSt11unique_lockINS_18BthreadSharedMutexEES4_bE3$_0E9_IteratorILb0EEEST_cEEEEERS0_RKSt17basic_string_viewIcSt11char_traitsIcEEDpOT_ Line | Count | Source | 90 | 14 | TaggableLogger& operator()(const std::string_view& fmt, Args&&... args) { | 91 | | if constexpr (sizeof...(args) == 0) { | 92 | | _msg.stream() << fmt; | 93 | 14 | } else { | 94 | 14 | _msg.stream() << fmt::format(fmt, std::forward<Args&&>(args)...); | 95 | 14 | } | 96 | 14 | return *this; | 97 | 14 | } |
_ZN5doris14TaggableLoggerclIJlRlNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_S8_S8_S8_S8_EEERS0_RKSt17basic_string_viewIcS6_EDpOT_ Line | Count | Source | 90 | 5 | TaggableLogger& operator()(const std::string_view& fmt, Args&&... args) { | 91 | | if constexpr (sizeof...(args) == 0) { | 92 | | _msg.stream() << fmt; | 93 | 5 | } else { | 94 | 5 | _msg.stream() << fmt::format(fmt, std::forward<Args&&>(args)...); | 95 | 5 | } | 96 | 5 | return *this; | 97 | 5 | } |
Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_RiEEERS0_RKSt17basic_string_viewIcS5_EDpOT_ unity_2_cxx.cxx:_ZN5doris14TaggableLoggerclIJlRlmN3fmt2v78arg_joinINSt6ranges14transform_viewINS6_8ref_viewISt6vectorISt10shared_ptrINS_6RowsetEESaISC_EEEEZNS_11CloudTablet29apply_visible_pending_rowsetsEvE3$_0E9_IteratorILb0EEESK_cEEEEERS0_RKSt17basic_string_viewIcSt11char_traitsIcEEDpOT_ Line | Count | Source | 90 | 119k | TaggableLogger& operator()(const std::string_view& fmt, Args&&... args) { | 91 | | if constexpr (sizeof...(args) == 0) { | 92 | | _msg.stream() << fmt; | 93 | 119k | } else { | 94 | 119k | _msg.stream() << fmt::format(fmt, std::forward<Args&&>(args)...); | 95 | 119k | } | 96 | 119k | return *this; | 97 | 119k | } |
Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJmEEERS0_RKSt17basic_string_viewIcSt11char_traitsIcEEDpOT_ Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERlS7_EEERS0_RKSt17basic_string_viewIcS5_EDpOT_ Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERllEEERS0_RKSt17basic_string_viewIcS5_EDpOT_ _ZN5doris14TaggableLoggerclIJlllEEERS0_RKSt17basic_string_viewIcSt11char_traitsIcEEDpOT_ Line | Count | Source | 90 | 12.3k | TaggableLogger& operator()(const std::string_view& fmt, Args&&... args) { | 91 | | if constexpr (sizeof...(args) == 0) { | 92 | | _msg.stream() << fmt; | 93 | 12.3k | } else { | 94 | 12.3k | _msg.stream() << fmt::format(fmt, std::forward<Args&&>(args)...); | 95 | 12.3k | } | 96 | 12.3k | return *this; | 97 | 12.3k | } |
_ZN5doris14TaggableLoggerclIJllllEEERS0_RKSt17basic_string_viewIcSt11char_traitsIcEEDpOT_ Line | Count | Source | 90 | 9.10k | TaggableLogger& operator()(const std::string_view& fmt, Args&&... args) { | 91 | | if constexpr (sizeof...(args) == 0) { | 92 | | _msg.stream() << fmt; | 93 | 9.10k | } else { | 94 | 9.10k | _msg.stream() << fmt::format(fmt, std::forward<Args&&>(args)...); | 95 | 9.10k | } | 96 | 9.10k | return *this; | 97 | 9.10k | } |
Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJRlNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EEERS0_RKSt17basic_string_viewIcS6_EDpOT_ Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERS7_RiEEERS0_RKSt17basic_string_viewIcS5_EDpOT_ Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJilEEERS0_RKSt17basic_string_viewIcSt11char_traitsIcEEDpOT_ _ZN5doris14TaggableLoggerclIJmiEEERS0_RKSt17basic_string_viewIcSt11char_traitsIcEEDpOT_ Line | Count | Source | 90 | 299 | TaggableLogger& operator()(const std::string_view& fmt, Args&&... args) { | 91 | | if constexpr (sizeof...(args) == 0) { | 92 | | _msg.stream() << fmt; | 93 | 299 | } else { | 94 | 299 | _msg.stream() << fmt::format(fmt, std::forward<Args&&>(args)...); | 95 | 299 | } | 96 | 299 | return *this; | 97 | 299 | } |
Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJRilEEERS0_RKSt17basic_string_viewIcSt11char_traitsIcEEDpOT_ Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJRilRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEERS0_RKSt17basic_string_viewIcS6_EDpOT_ _ZN5doris14TaggableLoggerclIJlRlEEERS0_RKSt17basic_string_viewIcSt11char_traitsIcEEDpOT_ Line | Count | Source | 90 | 1.16k | TaggableLogger& operator()(const std::string_view& fmt, Args&&... args) { | 91 | | if constexpr (sizeof...(args) == 0) { | 92 | | _msg.stream() << fmt; | 93 | 1.16k | } else { | 94 | 1.16k | _msg.stream() << fmt::format(fmt, std::forward<Args&&>(args)...); | 95 | 1.16k | } | 96 | 1.16k | return *this; | 97 | 1.16k | } |
_ZN5doris14TaggableLoggerclIJllEEERS0_RKSt17basic_string_viewIcSt11char_traitsIcEEDpOT_ Line | Count | Source | 90 | 58 | TaggableLogger& operator()(const std::string_view& fmt, Args&&... args) { | 91 | | if constexpr (sizeof...(args) == 0) { | 92 | | _msg.stream() << fmt; | 93 | 58 | } else { | 94 | 58 | _msg.stream() << fmt::format(fmt, std::forward<Args&&>(args)...); | 95 | 58 | } | 96 | 58 | return *this; | 97 | 58 | } |
Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJRlS2_S2_mEEERS0_RKSt17basic_string_viewIcSt11char_traitsIcEEDpOT_ Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJRiRKlS4_EEERS0_RKSt17basic_string_viewIcSt11char_traitsIcEEDpOT_ Unexecuted instantiation: _ZN5doris14TaggableLoggerclIJRllEEERS0_RKSt17basic_string_viewIcSt11char_traitsIcEEDpOT_ _ZN5doris14TaggableLoggerclIJRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERiS9_SA_SA_S9_EEERS0_RKSt17basic_string_viewIcS5_EDpOT_ Line | Count | Source | 90 | 133 | TaggableLogger& operator()(const std::string_view& fmt, Args&&... args) { | 91 | | if constexpr (sizeof...(args) == 0) { | 92 | | _msg.stream() << fmt; | 93 | 133 | } else { | 94 | 133 | _msg.stream() << fmt::format(fmt, std::forward<Args&&>(args)...); | 95 | 133 | } | 96 | 133 | return *this; | 97 | 133 | } |
_ZN5doris14TaggableLoggerclIJRlRKlEEERS0_RKSt17basic_string_viewIcSt11char_traitsIcEEDpOT_ Line | Count | Source | 90 | 12 | TaggableLogger& operator()(const std::string_view& fmt, Args&&... args) { | 91 | | if constexpr (sizeof...(args) == 0) { | 92 | | _msg.stream() << fmt; | 93 | 12 | } else { | 94 | 12 | _msg.stream() << fmt::format(fmt, std::forward<Args&&>(args)...); | 95 | 12 | } | 96 | 12 | return *this; | 97 | 12 | } |
|
98 | | |
99 | | template <typename V> |
100 | 1.70M | TaggableLogger& tag(std::string_view key, V&& value) { |
101 | 1.70M | _msg.stream() << '|' << key << '='; |
102 | | if constexpr (std::is_same_v<V, TUniqueId> || std::is_same_v<V, PUniqueId>) { |
103 | | _msg.stream() << print_id(value); |
104 | 1.70M | } else { |
105 | 1.70M | _msg.stream() << value; |
106 | 1.70M | } |
107 | 1.70M | return *this; |
108 | 1.70M | } Unexecuted instantiation: _ZN5doris14TaggableLogger3tagIRKNS_9TTaskType4typeEEERS0_St17basic_string_viewIcSt11char_traitsIcEEOT_ _ZN5doris14TaggableLogger3tagIRKiEERS0_St17basic_string_viewIcSt11char_traitsIcEEOT_ Line | Count | Source | 100 | 60 | TaggableLogger& tag(std::string_view key, V&& value) { | 101 | 60 | _msg.stream() << '|' << key << '='; | 102 | | if constexpr (std::is_same_v<V, TUniqueId> || std::is_same_v<V, PUniqueId>) { | 103 | | _msg.stream() << print_id(value); | 104 | 60 | } else { | 105 | 60 | _msg.stream() << value; | 106 | 60 | } | 107 | 60 | return *this; | 108 | 60 | } |
_ZN5doris14TaggableLogger3tagIRKNS_17TAgentTaskRequestEEERS0_St17basic_string_viewIcSt11char_traitsIcEEOT_ Line | Count | Source | 100 | 1.40k | TaggableLogger& tag(std::string_view key, V&& value) { | 101 | 1.40k | _msg.stream() << '|' << key << '='; | 102 | | if constexpr (std::is_same_v<V, TUniqueId> || std::is_same_v<V, PUniqueId>) { | 103 | | _msg.stream() << print_id(value); | 104 | 1.40k | } else { | 105 | 1.40k | _msg.stream() << value; | 106 | 1.40k | } | 107 | 1.40k | return *this; | 108 | 1.40k | } |
_ZN5doris14TaggableLogger3tagIRKlEERS0_St17basic_string_viewIcSt11char_traitsIcEEOT_ Line | Count | Source | 100 | 185k | TaggableLogger& tag(std::string_view key, V&& value) { | 101 | 185k | _msg.stream() << '|' << key << '='; | 102 | | if constexpr (std::is_same_v<V, TUniqueId> || std::is_same_v<V, PUniqueId>) { | 103 | | _msg.stream() << print_id(value); | 104 | 185k | } else { | 105 | 185k | _msg.stream() << value; | 106 | 185k | } | 107 | 185k | return *this; | 108 | 185k | } |
_ZN5doris14TaggableLogger3tagIRlEERS0_St17basic_string_viewIcSt11char_traitsIcEEOT_ Line | Count | Source | 100 | 294k | TaggableLogger& tag(std::string_view key, V&& value) { | 101 | 294k | _msg.stream() << '|' << key << '='; | 102 | | if constexpr (std::is_same_v<V, TUniqueId> || std::is_same_v<V, PUniqueId>) { | 103 | | _msg.stream() << print_id(value); | 104 | 294k | } else { | 105 | 294k | _msg.stream() << value; | 106 | 294k | } | 107 | 294k | return *this; | 108 | 294k | } |
_ZN5doris14TaggableLogger3tagIlEERS0_St17basic_string_viewIcSt11char_traitsIcEEOT_ Line | Count | Source | 100 | 201k | TaggableLogger& tag(std::string_view key, V&& value) { | 101 | 201k | _msg.stream() << '|' << key << '='; | 102 | | if constexpr (std::is_same_v<V, TUniqueId> || std::is_same_v<V, PUniqueId>) { | 103 | | _msg.stream() << print_id(value); | 104 | 201k | } else { | 105 | 201k | _msg.stream() << value; | 106 | 201k | } | 107 | 201k | return *this; | 108 | 201k | } |
_ZN5doris14TaggableLogger3tagIRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEERS0_St17basic_string_viewIcS5_EOT_ Line | Count | Source | 100 | 39 | TaggableLogger& tag(std::string_view key, V&& value) { | 101 | 39 | _msg.stream() << '|' << key << '='; | 102 | | if constexpr (std::is_same_v<V, TUniqueId> || std::is_same_v<V, PUniqueId>) { | 103 | | _msg.stream() << print_id(value); | 104 | 39 | } else { | 105 | 39 | _msg.stream() << value; | 106 | 39 | } | 107 | 39 | return *this; | 108 | 39 | } |
_ZN5doris14TaggableLogger3tagIRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEERS0_St17basic_string_viewIcS5_EOT_ Line | Count | Source | 100 | 90.9k | TaggableLogger& tag(std::string_view key, V&& value) { | 101 | 90.9k | _msg.stream() << '|' << key << '='; | 102 | | if constexpr (std::is_same_v<V, TUniqueId> || std::is_same_v<V, PUniqueId>) { | 103 | | _msg.stream() << print_id(value); | 104 | 90.9k | } else { | 105 | 90.9k | _msg.stream() << value; | 106 | 90.9k | } | 107 | 90.9k | return *this; | 108 | 90.9k | } |
Unexecuted instantiation: _ZN5doris14TaggableLogger3tagIRjEERS0_St17basic_string_viewIcSt11char_traitsIcEEOT_ Unexecuted instantiation: _ZN5doris14TaggableLogger3tagIRKbEERS0_St17basic_string_viewIcSt11char_traitsIcEEOT_ _ZN5doris14TaggableLogger3tagINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEERS0_St17basic_string_viewIcS5_EOT_ Line | Count | Source | 100 | 458k | TaggableLogger& tag(std::string_view key, V&& value) { | 101 | 458k | _msg.stream() << '|' << key << '='; | 102 | | if constexpr (std::is_same_v<V, TUniqueId> || std::is_same_v<V, PUniqueId>) { | 103 | | _msg.stream() << print_id(value); | 104 | 458k | } else { | 105 | 458k | _msg.stream() << value; | 106 | 458k | } | 107 | 458k | return *this; | 108 | 458k | } |
_ZN5doris14TaggableLogger3tagIRKNS_9TPushType4typeEEERS0_St17basic_string_viewIcSt11char_traitsIcEEOT_ Line | Count | Source | 100 | 3.19k | TaggableLogger& tag(std::string_view key, V&& value) { | 101 | 3.19k | _msg.stream() << '|' << key << '='; | 102 | | if constexpr (std::is_same_v<V, TUniqueId> || std::is_same_v<V, PUniqueId>) { | 103 | | _msg.stream() << print_id(value); | 104 | 3.19k | } else { | 105 | 3.19k | _msg.stream() << value; | 106 | 3.19k | } | 107 | 3.19k | return *this; | 108 | 3.19k | } |
_ZN5doris14TaggableLogger3tagImEERS0_St17basic_string_viewIcSt11char_traitsIcEEOT_ Line | Count | Source | 100 | 90.5k | TaggableLogger& tag(std::string_view key, V&& value) { | 101 | 90.5k | _msg.stream() << '|' << key << '='; | 102 | | if constexpr (std::is_same_v<V, TUniqueId> || std::is_same_v<V, PUniqueId>) { | 103 | | _msg.stream() << print_id(value); | 104 | 90.5k | } else { | 105 | 90.5k | _msg.stream() << value; | 106 | 90.5k | } | 107 | 90.5k | return *this; | 108 | 90.5k | } |
_ZN5doris14TaggableLogger3tagIRiEERS0_St17basic_string_viewIcSt11char_traitsIcEEOT_ Line | Count | Source | 100 | 347k | TaggableLogger& tag(std::string_view key, V&& value) { | 101 | 347k | _msg.stream() << '|' << key << '='; | 102 | | if constexpr (std::is_same_v<V, TUniqueId> || std::is_same_v<V, PUniqueId>) { | 103 | | _msg.stream() << print_id(value); | 104 | 347k | } else { | 105 | 347k | _msg.stream() << value; | 106 | 347k | } | 107 | 347k | return *this; | 108 | 347k | } |
_ZN5doris14TaggableLogger3tagIiEERS0_St17basic_string_viewIcSt11char_traitsIcEEOT_ Line | Count | Source | 100 | 13.6k | TaggableLogger& tag(std::string_view key, V&& value) { | 101 | 13.6k | _msg.stream() << '|' << key << '='; | 102 | | if constexpr (std::is_same_v<V, TUniqueId> || std::is_same_v<V, PUniqueId>) { | 103 | | _msg.stream() << print_id(value); | 104 | 13.6k | } else { | 105 | 13.6k | _msg.stream() << value; | 106 | 13.6k | } | 107 | 13.6k | return *this; | 108 | 13.6k | } |
Unexecuted instantiation: _ZN5doris14TaggableLogger3tagIRKmEERS0_St17basic_string_viewIcSt11char_traitsIcEEOT_ _ZN5doris14TaggableLogger3tagIRmEERS0_St17basic_string_viewIcSt11char_traitsIcEEOT_ Line | Count | Source | 100 | 21.1k | TaggableLogger& tag(std::string_view key, V&& value) { | 101 | 21.1k | _msg.stream() << '|' << key << '='; | 102 | | if constexpr (std::is_same_v<V, TUniqueId> || std::is_same_v<V, PUniqueId>) { | 103 | | _msg.stream() << print_id(value); | 104 | 21.1k | } else { | 105 | 21.1k | _msg.stream() << value; | 106 | 21.1k | } | 107 | 21.1k | return *this; | 108 | 21.1k | } |
_ZN5doris14TaggableLogger3tagISt17basic_string_viewIcSt11char_traitsIcEEEERS0_S5_OT_ Line | Count | Source | 100 | 4 | TaggableLogger& tag(std::string_view key, V&& value) { | 101 | 4 | _msg.stream() << '|' << key << '='; | 102 | | if constexpr (std::is_same_v<V, TUniqueId> || std::is_same_v<V, PUniqueId>) { | 103 | | _msg.stream() << print_id(value); | 104 | 4 | } else { | 105 | 4 | _msg.stream() << value; | 106 | 4 | } | 107 | 4 | return *this; | 108 | 4 | } |
_ZN5doris14TaggableLogger3tagIPcEERS0_St17basic_string_viewIcSt11char_traitsIcEEOT_ Line | Count | Source | 100 | 2 | TaggableLogger& tag(std::string_view key, V&& value) { | 101 | 2 | _msg.stream() << '|' << key << '='; | 102 | | if constexpr (std::is_same_v<V, TUniqueId> || std::is_same_v<V, PUniqueId>) { | 103 | | _msg.stream() << print_id(value); | 104 | 2 | } else { | 105 | 2 | _msg.stream() << value; | 106 | 2 | } | 107 | 2 | return *this; | 108 | 2 | } |
Unexecuted instantiation: _ZN5doris14TaggableLogger3tagIPKcEERS0_St17basic_string_viewIcSt11char_traitsIcEEOT_ Unexecuted instantiation: _ZN5doris14TaggableLogger3tagIRbEERS0_St17basic_string_viewIcSt11char_traitsIcEEOT_ Unexecuted instantiation: _ZN5doris14TaggableLogger3tagIRKSt6vectorINS_7VersionESaIS3_EEEERS0_St17basic_string_viewIcSt11char_traitsIcEEOT_ Unexecuted instantiation: _ZN5doris14TaggableLogger3tagIRNS_6StatusEEERS0_St17basic_string_viewIcSt11char_traitsIcEEOT_ Unexecuted instantiation: _ZN5doris14TaggableLogger3tagIRA8_KcEERS0_St17basic_string_viewIcSt11char_traitsIcEEOT_ Unexecuted instantiation: _ZN5doris14TaggableLogger3tagIRA10_KcEERS0_St17basic_string_viewIcSt11char_traitsIcEEOT_ Unexecuted instantiation: _ZN5doris14TaggableLogger3tagIRA32_KcEERS0_St17basic_string_viewIcSt11char_traitsIcEEOT_ |
109 | | |
110 | | template <typename E> |
111 | 1.50k | TaggableLogger& error(E&& error) { |
112 | 1.50k | _msg.stream() << "|error=" << error; |
113 | 1.50k | return *this; |
114 | 1.50k | } Unexecuted instantiation: _ZN5doris14TaggableLogger5errorIRNS_7TStatusEEERS0_OT_ _ZN5doris14TaggableLogger5errorIRNS_6StatusEEERS0_OT_ Line | Count | Source | 111 | 1.50k | TaggableLogger& error(E&& error) { | 112 | 1.50k | _msg.stream() << "|error=" << error; | 113 | 1.50k | return *this; | 114 | 1.50k | } |
|
115 | | |
116 | | private: |
117 | | google::LogMessage _msg; |
118 | | }; |
119 | | |
120 | | // Very very important!!!! |
121 | | // Never define LOG_DEBUG or LOG_TRACE. because the tagged logging method will |
122 | | // always generated string and then check the log level, its performane is bad. |
123 | | // glog's original method will first check log level if it is not satisfied, |
124 | | // the log message is not generated. |
125 | 2.16M | #define LOG_INFO TaggableLogger(__FILE__, __LINE__, google::GLOG_INFO) |
126 | 30.3k | #define LOG_WARNING TaggableLogger(__FILE__, __LINE__, google::GLOG_WARNING) |
127 | 4 | #define LOG_ERROR TaggableLogger(__FILE__, __LINE__, google::GLOG_ERROR) |
128 | 0 | #define LOG_FATAL TaggableLogger(__FILE__, __LINE__, google::GLOG_FATAL) |
129 | | |
130 | | // Avoid the printed log message is truncated by the glog max log size limit |
131 | | #define LOG_LONG_STRING(severity, long_log_str) \ |
132 | 5 | do { \ |
133 | 5 | constexpr size_t max_log_size = 30000 - 100; \ |
134 | 5 | size_t pos = 0; \ |
135 | 5 | size_t total_size = long_log_str.size(); \ |
136 | 5 | size_t tmp_size = std::min(max_log_size, total_size); \ |
137 | 10 | while (pos < total_size) { \ |
138 | 5 | tmp_size = std::min(max_log_size, total_size - pos); \ |
139 | 5 | LOG(severity) << std::string(long_log_str.data() + pos, tmp_size); \ |
140 | 5 | pos += tmp_size; \ |
141 | 5 | } \ |
142 | 5 | } while (0) |
143 | | |
144 | | } // namespace doris |