Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/ggml/blob/master/src/ggml-rpc/log.h # ggml [Ported from github.com/ggml-org/ggml] docs : sync ggml_type enum in gguf.md (#1685) Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `ggml / src / ggml-rpc / log.h` 49 lines ยท 1685 bytes Raw Blame History 1 #pragma once 2 3 // Log infrastructure for the RPC backend: LOG_* are unconditional, LOG_DBG* are gated by GGML_RPC_DEBUG 4 5 #include "ggml-impl.h" 6 7 #include 8 #include 9 #include 10 11 // GGML_RPC_DEBUG verbosity: unset / 0 disabled, 1 connections and allocations, 2 per-command trace, 12 // 3 per-message detail. Non-numeric values fall back to 1 13 static inline int rpc_log_debug_level() { 14 static const int level = [] { 15 const char * env = std::getenv("GGML_RPC_DEBUG"); 16 if (env == nullptr) { 17 return 0; 18 } 19 if (env[0] == '\0') { 20 return 1; 21 } 22 int value = 0; 23 for (const char * p = env; *p != '\0'; p++) { 24 if (*p < '0' || *p > '9') { 25 return 1; 26 } 27 value = value * 10 + (*p - '0'); 28 if (value > 3) { 29 value = 3; 30 } 31 } 32 return value; 33 }(); 34 return level; 35 } 36 37 // Byte counts in binary units, e.g. 8208 -> "8.02 KiB". Sizes below 1 KiB stay in plain bytes 38 std::string rpc_log_format_size(size_t size); 39 40 // Tensor identity: "blk.0.attn_q.weight [NONE, f16, [4096, 4096, 1, 1]]" 41 std::string rpc_log_format_tensor(const ggml_tensor * tensor); 42 43 #define LOG_INFO(...) GGML_LOG_INFO(__VA_ARGS__) 44 #define LOG_WARN(...) GGML_LOG_WARN(__VA_ARGS__) 45 #define LOG_ERROR(...) GGML_LOG_ERROR(__VA_ARGS__) 46 47 #define LOG_DBG(...) do { if (rpc_log_debug_level() >= 1) GGML_LOG_DEBUG(__VA_ARGS__); } while (0) 48 #define LOG_DBG2(...) do { if (rpc_log_debug_level() >= 2) GGML_LOG_DEBUG(__VA_ARGS__); } while (0) 49 #define LOG_DBG3(...) do { if (rpc_log_debug_level() >= 3) GGML_LOG_DEBUG(__VA_ARGS__); } while (0)