summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/eina/eina_log.c78
1 files changed, 49 insertions, 29 deletions
diff --git a/src/lib/eina/eina_log.c b/src/lib/eina/eina_log.c
index b5444688bc..9d518c9b21 100644
--- a/src/lib/eina/eina_log.c
+++ b/src/lib/eina/eina_log.c
@@ -1191,6 +1191,16 @@ eina_log_domain_unregister_unlocked(int domain)
1191 d->deleted = 1; 1191 d->deleted = 1;
1192} 1192}
1193 1193
1194#ifdef EINA_LOG_BACKTRACE
1195# define DISPLAY_BACKTRACE(File, Level) \
1196 if (EINA_UNLIKELY(Level <= _backtrace_level)) { \
1197 fprintf(File, "*** Backtrace ***\n"); \
1198 EINA_BT(File); \
1199 }
1200#else
1201# define DISPLAY_BACKTRACE(File, Level)
1202#endif
1203
1194static inline void 1204static inline void
1195eina_log_print_unlocked(int domain, 1205eina_log_print_unlocked(int domain,
1196 Eina_Log_Level level, 1206 Eina_Log_Level level,
@@ -1206,28 +1216,35 @@ eina_log_print_unlocked(int domain,
1206 if (EINA_UNLIKELY((unsigned int)domain >= _log_domains_count) || 1216 if (EINA_UNLIKELY((unsigned int)domain >= _log_domains_count) ||
1207 EINA_UNLIKELY(domain < 0)) 1217 EINA_UNLIKELY(domain < 0))
1208 { 1218 {
1209 if (file && fnc && fmt) 1219 DECLARE_LEVEL_NAME(level);
1220 if (level > _log_level)
1210 { 1221 {
1211 fprintf( 1222 fprintf(stderr, "CRI<%u>:eina_log %s:%d %s() unknown log domain %d, "
1212 stderr, 1223 "original message level was: %s\n", eina_log_pid_get(),
1213 "CRI: %s:%d %s() eina_log_print() unknown domain %d, original message format '%s'\n", 1224 file, line, fnc, domain, name);
1214 file,
1215 line,
1216 fnc,
1217 domain,
1218 fmt);
1219 } 1225 }
1220 else 1226 else
1221 { 1227 {
1222 fprintf( 1228 if (file && fnc && fmt)
1223 stderr, 1229 {
1224 "CRI: eina_log_print() unknown domain %d, original message format '%s'\n", 1230 fprintf(stderr, "CRI<%u>:eina_log %s:%d %s() unknown log domain %d, "
1225 domain, 1231 "original message was: %s: '", eina_log_pid_get(),
1226 fmt ? fmt : ""); 1232 file, line, fnc, domain, name);
1233 vfprintf(stderr, fmt, args);
1234 }
1235 else
1236 {
1237 fprintf(stderr, "CRI<%u>:eina_log unknown log domain %d, original "
1238 "message was: %s: '", eina_log_pid_get(), domain, name);
1239 if (fmt)
1240 vfprintf(stderr, fmt, args);
1241 }
1242 fputs("'\n", stderr);
1227 } 1243 }
1228 1244
1229 if (_abort_on_critical) 1245 DISPLAY_BACKTRACE(stderr, level);
1230 abort(); 1246 if (EINA_UNLIKELY(_abort_on_critical))
1247 abort();
1231 1248
1232 return; 1249 return;
1233 } 1250 }
@@ -1237,9 +1254,22 @@ eina_log_print_unlocked(int domain,
1237#ifdef EINA_SAFETY_CHECKS 1254#ifdef EINA_SAFETY_CHECKS
1238 if (EINA_UNLIKELY(d->deleted)) 1255 if (EINA_UNLIKELY(d->deleted))
1239 { 1256 {
1240 fprintf(stderr, 1257 if (level > d->level)
1241 "ERR: eina_log_print() domain %d is deleted\n", 1258 fprintf(stderr, "ERR<%u>:eina_log %s:%d %s() log domain %d was deleted\n",
1242 domain); 1259 eina_log_pid_get(), file, line, fnc, domain);
1260 else
1261 {
1262 DECLARE_LEVEL_NAME(level);
1263 fprintf(stderr, "ERR<%u>:eina_log %s:%d %s() log domain %d was "
1264 "deleted, original message was: %s: '",
1265 eina_log_pid_get(), file, line, fnc, domain, name);
1266 vfprintf(stderr, fmt, args);
1267 fputs("'\n", stderr);
1268 }
1269 DISPLAY_BACKTRACE(stderr, level);
1270 if (EINA_UNLIKELY(_abort_on_critical) &&
1271 EINA_UNLIKELY(level <= _abort_level_on_critical))
1272 abort();
1243 return; 1273 return;
1244 } 1274 }
1245 1275
@@ -1853,16 +1883,6 @@ eina_log_domain_registered_level_set(int domain, int level)
1853#endif 1883#endif
1854} 1884}
1855 1885
1856#ifdef EINA_LOG_BACKTRACE
1857# define DISPLAY_BACKTRACE(File, Level) \
1858 if (EINA_UNLIKELY(Level <= _backtrace_level)) { \
1859 fprintf(File, "*** Backtrace ***\n"); \
1860 EINA_BT(File); \
1861 }
1862#else
1863# define DISPLAY_BACKTRACE(File, Level)
1864#endif
1865
1866EAPI void 1886EAPI void
1867eina_log_print_cb_stderr(const Eina_Log_Domain *d, 1887eina_log_print_cb_stderr(const Eina_Log_Domain *d,
1868 Eina_Log_Level level, 1888 Eina_Log_Level level,