MCPcopy Create free account
hub / github.com/antirez/llama.cpp-deepseek-v4-flash / print

Method print

common/log.cpp:76–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74 bool is_end;
75
76 void print(FILE * file = nullptr) const {
77 FILE * fcur = file;
78 if (!fcur) {
79 // stderr displays DBG messages only when their verbosity level is not higher than the threshold
80 // these messages will still be logged to a file
81 if (level == GGML_LOG_LEVEL_DEBUG && common_log_verbosity_thold < LOG_DEFAULT_DEBUG) {
82 return;
83 }
84
85 fcur = stdout;
86
87 if (level != GGML_LOG_LEVEL_NONE) {
88 fcur = stderr;
89 }
90 }
91
92 if (level != GGML_LOG_LEVEL_NONE && level != GGML_LOG_LEVEL_CONT && prefix) {
93 if (timestamp) {
94 // [M.s.ms.us]
95 fprintf(fcur, "%s%d.%02d.%03d.%03d%s ",
96 g_col[COMMON_LOG_COL_BLUE],
97 (int) (timestamp / 1000000 / 60),
98 (int) (timestamp / 1000000 % 60),
99 (int) (timestamp / 1000 % 1000),
100 (int) (timestamp % 1000),
101 g_col[COMMON_LOG_COL_DEFAULT]);
102 }
103
104 switch (level) {
105 case GGML_LOG_LEVEL_INFO: fprintf(fcur, "%sI %s", g_col[COMMON_LOG_COL_GREEN], g_col[COMMON_LOG_COL_DEFAULT]); break;
106 case GGML_LOG_LEVEL_WARN: fprintf(fcur, "%sW %s", g_col[COMMON_LOG_COL_MAGENTA], "" ); break;
107 case GGML_LOG_LEVEL_ERROR: fprintf(fcur, "%sE %s", g_col[COMMON_LOG_COL_RED], "" ); break;
108 case GGML_LOG_LEVEL_DEBUG: fprintf(fcur, "%sD %s", g_col[COMMON_LOG_COL_YELLOW], "" ); break;
109 default:
110 break;
111 }
112 }
113
114 fprintf(fcur, "%s", msg.data());
115
116 if (level == GGML_LOG_LEVEL_WARN || level == GGML_LOG_LEVEL_ERROR || level == GGML_LOG_LEVEL_DEBUG) {
117 fprintf(fcur, "%s", g_col[COMMON_LOG_COL_DEFAULT]);
118 }
119
120 fflush(fcur);
121 }
122};
123
124struct common_log {

Callers 1

resumeMethod · 0.45

Calls 1

dataMethod · 0.45

Tested by

no test coverage detected