Skip to content

Commit

Permalink
Tweaked: Color output for GAIA_LOG_x macros
Browse files Browse the repository at this point in the history
Fixed: GAIA_LOG_W/E didn't output to stderr entirely
  • Loading branch information
richardbiely committed Mar 17, 2024
1 parent 7367226 commit 08a0fbe
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ ecs::Query q2 = w.query()
```

### Uncached query
From the implementation standpoint, uncached queries are the same as ordinary queries in all but one aspect - they do not use the query cache internally. This means that two uncached queries using the same setup are going to evaluate matches separately. As a result, if there are duplicates, more memory and performance is be wasted.
From the implementation standpoint, uncached queries are the same as ordinary queries in all but one aspect - they do not use the query cache internally. This means that two uncached queries using the same setup are going to evaluate matches separately. As a result, if there are duplicates, more memory and performance will be wasted.

On the other hand, if you design your queries carefully and they are all different, uncached queries are actually a bit faster to create and match. Creation is faster because there is no hash to compute for the query and matching is faster because no query cache lookups are involved.

Expand Down
12 changes: 6 additions & 6 deletions include/gaia/config/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#ifndef GAIA_LOG_D
#define GAIA_LOG_D(...) \
{ \
fprintf(stdout, "%s %s, D: ", __DATE__, __TIME__); \
fprintf(stdout, "\033[1;32m%s %s, D: ", __DATE__, __TIME__); \
fprintf(stdout, __VA_ARGS__); \
fprintf(stdout, "\n"); \
fprintf(stdout, "\033[0m\n"); \
}
#endif

Expand All @@ -26,18 +26,18 @@
#ifndef GAIA_LOG_W
#define GAIA_LOG_W(...) \
{ \
fprintf(stdout, "%s %s, W: ", __DATE__, __TIME__); \
fprintf(stderr, "\033[1;33m%s %s, W: ", __DATE__, __TIME__); \
fprintf(stderr, __VA_ARGS__); \
fprintf(stderr, "\n"); \
fprintf(stderr, "\033[0m\n"); \
}
#endif

//! Log - error
#ifndef GAIA_LOG_E
#define GAIA_LOG_E(...) \
{ \
fprintf(stdout, "%s %s, E: ", __DATE__, __TIME__); \
fprintf(stderr, "\033[1;31m%s %s, E: ", __DATE__, __TIME__); \
fprintf(stderr, __VA_ARGS__); \
fprintf(stderr, "\n"); \
fprintf(stderr, "\033[0m\n"); \
}
#endif
12 changes: 6 additions & 6 deletions single_include/gaia.h
Original file line number Diff line number Diff line change
Expand Up @@ -847,9 +847,9 @@ namespace gaia {
#ifndef GAIA_LOG_D
#define GAIA_LOG_D(...) \
{ \
fprintf(stdout, "%s %s, D: ", __DATE__, __TIME__); \
fprintf(stdout, "\033[1;32m%s %s, D: ", __DATE__, __TIME__); \
fprintf(stdout, __VA_ARGS__); \
fprintf(stdout, "\n"); \
fprintf(stdout, "\033[0m\n"); \
}
#endif

Expand All @@ -867,19 +867,19 @@ namespace gaia {
#ifndef GAIA_LOG_W
#define GAIA_LOG_W(...) \
{ \
fprintf(stdout, "%s %s, W: ", __DATE__, __TIME__); \
fprintf(stderr, "\033[1;33m%s %s, W: ", __DATE__, __TIME__); \
fprintf(stderr, __VA_ARGS__); \
fprintf(stderr, "\n"); \
fprintf(stderr, "\033[0m\n"); \
}
#endif

//! Log - error
#ifndef GAIA_LOG_E
#define GAIA_LOG_E(...) \
{ \
fprintf(stdout, "%s %s, E: ", __DATE__, __TIME__); \
fprintf(stderr, "\033[1;31m%s %s, E: ", __DATE__, __TIME__); \
fprintf(stderr, __VA_ARGS__); \
fprintf(stderr, "\n"); \
fprintf(stderr, "\033[0m\n"); \
}
#endif

Expand Down

0 comments on commit 08a0fbe

Please sign in to comment.