MCPcopy Create free account
hub / github.com/ClusterLabs/pacemaker / set_format_string

Function set_format_string

lib/common/logging.c:170–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168
169#define FMT_MAX 256
170static void
171set_format_string(int method, const char *daemon)
172{
173 int offset = 0;
174 char fmt[FMT_MAX];
175
176 if (method > QB_LOG_STDERR) {
177 /* When logging to a file */
178 struct utsname res;
179
180 if (uname(&res) == 0) {
181 offset +=
182 snprintf(fmt + offset, FMT_MAX - offset, "%%t [%d] %s %10s: ", getpid(),
183 res.nodename, daemon);
184 } else {
185 offset += snprintf(fmt + offset, FMT_MAX - offset, "%%t [%d] %10s: ", getpid(), daemon);
186 }
187 }
188
189 if (crm_tracing_enabled() && method >= QB_LOG_STDERR) {
190 offset += snprintf(fmt + offset, FMT_MAX - offset, "(%%-12f:%%5l %%g) %%-7p: %%n: ");
191 } else {
192 offset += snprintf(fmt + offset, FMT_MAX - offset, "%%g %%-7p: %%n: ");
193 }
194
195 if (method == QB_LOG_SYSLOG) {
196 offset += snprintf(fmt + offset, FMT_MAX - offset, "%%b");
197 } else {
198 offset += snprintf(fmt + offset, FMT_MAX - offset, "\t%%b");
199 }
200 qb_log_format_set(method, fmt);
201}
202
203gboolean
204crm_add_logfile(const char *filename)

Callers 1

crm_log_initFunction · 0.85

Calls 1

crm_tracing_enabledFunction · 0.85

Tested by

no test coverage detected