MCPcopy Create free account
hub / github.com/BlueAndi/Pixelix / processLogMessage

Method processLogMessage

lib/Logging/src/Logging.cpp:148–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

146}
147
148void Logging::processLogMessage(const char* file, int line, const Logging::LogLevel messageLogLevel, const char* format, ...)
149{
150 if ((true == isSeverityEnabled(messageLogLevel)) &&
151 (nullptr != m_selectedSink))
152 {
153 char buffer[MESSAGE_BUFFER_SIZE];
154 int written = 0;
155 const char* STR_CUT_OFF_SEQ = "...";
156 const uint16_t STR_CUT_OFF_SEQ_LEN = strlen(STR_CUT_OFF_SEQ);
157 va_list args;
158 Msg msg;
159
160 va_start(args, format);
161 written = vsnprintf(buffer, MESSAGE_BUFFER_SIZE - STR_CUT_OFF_SEQ_LEN, format, args); /* NOLINT(clang-analyzer-valist.Uninitialized) */
162 va_end(args);
163
164 /* If buffer was too small or any other error happended, it shall be shown in the
165 * output string message with the STR_CUT_OFF_SEQ.
166 */
167 if ((0 > written) ||
168 ((MESSAGE_BUFFER_SIZE - STR_CUT_OFF_SEQ_LEN) <= written))
169 {
170 strncat(buffer, STR_CUT_OFF_SEQ, MESSAGE_BUFFER_SIZE - strlen(buffer) - 1U);
171 }
172
173 msg.timestamp = esp_log_timestamp();
174 msg.level = messageLogLevel;
175 msg.filename = getBaseNameFromPath(file);
176 msg.line = line;
177 msg.str = buffer;
178
179 m_selectedSink->send(msg);
180 }
181 else
182 {
183 /* LogMessage is discarded! */
184 }
185}
186
187void Logging::processLogMessage(const char* file, int line, const Logging::LogLevel messageLogLevel, const String& message)
188{

Callers

nothing calls this directly

Calls 3

esp_log_timestampFunction · 0.85
c_strMethod · 0.80
sendMethod · 0.45

Tested by

no test coverage detected