Skip to content

Commit

Permalink
remove exit() from lib. fix #634 (#696)
Browse files Browse the repository at this point in the history
* remove exit() from lib. fix #634
* remove the UFATAL loglevel completely.
  • Loading branch information
slyshykO authored and xor-gate committed Mar 28, 2018
1 parent 2ee6edc commit 7ec1fb7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
11 changes: 4 additions & 7 deletions include/stlink/logging.h
Expand Up @@ -10,11 +10,10 @@ extern "C" {
#endif

enum ugly_loglevel {
UDEBUG = 90,
UINFO = 50,
UWARN = 30,
UERROR = 20,
UFATAL = 10
UDEBUG = 90,
UINFO = 50,
UWARN = 30,
UERROR = 20
};

int ugly_init(int maximum_threshold);
Expand All @@ -33,8 +32,6 @@ int ugly_log(int level, const char *tag, const char *format, ...);
#define WLOG(...) WLOG_HELPER(__VA_ARGS__, "")
#define ELOG_HELPER(format, ...) ugly_log(UERROR, UGLY_LOG_FILE, format, __VA_ARGS__)
#define ELOG(...) ELOG_HELPER(__VA_ARGS__, "")
#define fatal_helper(format, ...) ugly_log(UFATAL, UGLY_LOG_FILE, format, __VA_ARGS__)
#define fatal(...) fatal_helper(__VA_ARGS__, "")

#ifdef __cplusplus
}
Expand Down
6 changes: 0 additions & 6 deletions src/logging.c
Expand Up @@ -41,12 +41,6 @@ int ugly_log(int level, const char *tag, const char *format, ...) {
case UERROR:
fprintf(stderr, "ERROR %s: ", tag);
break;
case UFATAL:
fprintf(stderr, "FATAL %s: ", tag);
vfprintf(stderr, format, args);
exit(EXIT_FAILURE);
// NEVER GETS HERE!!!
break;
default:
fprintf(stderr, "%d %s: ", level, tag);
break;
Expand Down

0 comments on commit 7ec1fb7

Please sign in to comment.