simdjson  3.1.8
Ridiculously Fast JSON
logger.h
1 namespace simdjson {
2 namespace SIMDJSON_IMPLEMENTATION {
3 namespace ondemand {
4 
5 class json_iterator;
6 class value_iterator;
7 
8 namespace logger {
9 
10 enum class log_level : int32_t {
11  LOG_INFO = 0,
12  LOG_ERROR = 1
13 };
14 
15 #if SIMDJSON_VERBOSE_LOGGING
16  static constexpr const bool LOG_ENABLED = true;
17 #else
18  static constexpr const bool LOG_ENABLED = false;
19 #endif
20 
21 // We do not want these functions to be 'really inlined' since real inlining is
22 // for performance purposes and if you are using the loggers, you do not care about
23 // performance (or should not).
24 template<typename... Args>
25 static inline std::string string_format(const std::string& format, const Args&... args);
26 static inline void log_headers() noexcept;
27 static inline void log_line(const json_iterator &iter, token_position index, depth_t depth, const char *title_prefix, const char *title, std::string_view detail, log_level level) noexcept;
28 static inline void log_line(const json_iterator &iter, const char *title_prefix, const char *title, std::string_view detail, int delta, int depth_delta, log_level level) noexcept;
29 static inline void log_event(const json_iterator &iter, const char *type, std::string_view detail="", int delta=0, int depth_delta=0) noexcept;
30 static inline void log_value(const json_iterator &iter, token_position index, depth_t depth, const char *type, std::string_view detail="") noexcept;
31 static inline void log_value(const json_iterator &iter, const char *type, std::string_view detail="", int delta=-1, int depth_delta=0) noexcept;
32 static inline void log_start_value(const json_iterator &iter, token_position index, depth_t depth, const char *type, std::string_view detail="") noexcept;
33 static inline void log_start_value(const json_iterator &iter, const char *type, int delta=-1, int depth_delta=0) noexcept;
34 static inline void log_end_value(const json_iterator &iter, const char *type, int delta=-1, int depth_delta=0) noexcept;
35 static inline void log_error(const json_iterator &iter, token_position index, depth_t depth, const char *error, const char *detail="") noexcept;
36 static inline void log_error(const json_iterator &iter, const char *error, const char *detail="", int delta=-1, int depth_delta=0) noexcept;
37 
38 static inline void log_event(const value_iterator &iter, const char *type, std::string_view detail="", int delta=0, int depth_delta=0) noexcept;
39 static inline void log_value(const value_iterator &iter, const char *type, std::string_view detail="", int delta=-1, int depth_delta=0) noexcept;
40 static inline void log_start_value(const value_iterator &iter, const char *type, int delta=-1, int depth_delta=0) noexcept;
41 static inline void log_end_value(const value_iterator &iter, const char *type, int delta=-1, int depth_delta=0) noexcept;
42 static inline void log_error(const value_iterator &iter, const char *error, const char *detail="", int delta=-1, int depth_delta=0) noexcept;
43 
44 } // namespace logger
45 } // namespace ondemand
46 } // namespace SIMDJSON_IMPLEMENTATION
47 } // namespace simdjson
int32_t depth_t
Represents the depth of a JSON value (number of nested arrays/objects).
Definition: ondemand.h:11
We want to support argument-dependent lookup (ADL).