Mercurial
annotate seobeo/s_logging.c @ 167:589bab390fb4
[ThirdParty] Added sqlite3 to the third_party.
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Mon, 19 Jan 2026 16:28:45 -0800 |
| parents | dbf14f84d51c |
| children |
| rev | line source |
|---|---|
|
124
dbf14f84d51c
Refactor Seobeo and mrjunejune build files so it works.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1 #include "seobeo/seobeo.h" |
|
dbf14f84d51c
Refactor Seobeo and mrjunejune build files so it works.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2 |
|
dbf14f84d51c
Refactor Seobeo and mrjunejune build files so it works.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3 static char *Seobeo_Log_Level_String(Seobeo_Log_Level level) |
|
dbf14f84d51c
Refactor Seobeo and mrjunejune build files so it works.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4 { |
|
dbf14f84d51c
Refactor Seobeo and mrjunejune build files so it works.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5 switch(level) |
|
dbf14f84d51c
Refactor Seobeo and mrjunejune build files so it works.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6 { |
|
dbf14f84d51c
Refactor Seobeo and mrjunejune build files so it works.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
7 case SEOBEO_DEBUG: return "DEBUG"; |
|
dbf14f84d51c
Refactor Seobeo and mrjunejune build files so it works.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
8 case SEOBEO_INFO: return "INFO"; |
|
dbf14f84d51c
Refactor Seobeo and mrjunejune build files so it works.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
9 case SEOBEO_WARNING: return "WARNING"; |
|
dbf14f84d51c
Refactor Seobeo and mrjunejune build files so it works.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
10 case SEOBEO_ERROR: return "ERROR"; |
|
dbf14f84d51c
Refactor Seobeo and mrjunejune build files so it works.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
11 default: return "INFO"; |
|
dbf14f84d51c
Refactor Seobeo and mrjunejune build files so it works.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
12 } |
|
dbf14f84d51c
Refactor Seobeo and mrjunejune build files so it works.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
13 } |
|
dbf14f84d51c
Refactor Seobeo and mrjunejune build files so it works.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
14 |
|
dbf14f84d51c
Refactor Seobeo and mrjunejune build files so it works.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
15 int Seobeo_Log(Seobeo_Log_Level level, const char * restrict format, ...) |
|
dbf14f84d51c
Refactor Seobeo and mrjunejune build files so it works.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
16 { |
|
dbf14f84d51c
Refactor Seobeo and mrjunejune build files so it works.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
17 #ifndef SEOBEO_ENABLE_DEBUG |
|
dbf14f84d51c
Refactor Seobeo and mrjunejune build files so it works.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
18 if (level == SEOBEO_DEBUG) |
|
dbf14f84d51c
Refactor Seobeo and mrjunejune build files so it works.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
19 return 0; |
|
dbf14f84d51c
Refactor Seobeo and mrjunejune build files so it works.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
20 #endif |
|
dbf14f84d51c
Refactor Seobeo and mrjunejune build files so it works.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
21 |
|
dbf14f84d51c
Refactor Seobeo and mrjunejune build files so it works.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
22 int result; |
|
dbf14f84d51c
Refactor Seobeo and mrjunejune build files so it works.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
23 va_list args; |
|
dbf14f84d51c
Refactor Seobeo and mrjunejune build files so it works.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
24 printf("[%s] ", Seobeo_Log_Level_String(level)); |
|
dbf14f84d51c
Refactor Seobeo and mrjunejune build files so it works.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
25 va_start(args, format); |
|
dbf14f84d51c
Refactor Seobeo and mrjunejune build files so it works.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
26 result = vprintf(format, args); |
|
dbf14f84d51c
Refactor Seobeo and mrjunejune build files so it works.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
27 va_end(args); |
|
dbf14f84d51c
Refactor Seobeo and mrjunejune build files so it works.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
28 |
|
dbf14f84d51c
Refactor Seobeo and mrjunejune build files so it works.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
29 return result; |
|
dbf14f84d51c
Refactor Seobeo and mrjunejune build files so it works.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
30 } |