CLOG: Add getter to know if output supports coloring

This commit is contained in:
Clément Foucault 2020-10-23 19:26:35 +02:00
parent 23eaf3117c
commit 8442d6ca8a
2 changed files with 10 additions and 0 deletions

View File

@ -150,6 +150,8 @@ void CLG_level_set(int level);
void CLG_logref_init(CLG_LogRef *clg_ref);
int CLG_color_support_get(CLG_LogRef *clg_ref);
/** Declare outside function, declare as extern in header. */
#define CLG_LOGREF_DECLARE_GLOBAL(var, id) \
static CLG_LogRef _static_##var = {id}; \

View File

@ -755,4 +755,12 @@ void CLG_logref_init(CLG_LogRef *clg_ref)
#endif
}
int CLG_color_support_get(CLG_LogRef *clg_ref)
{
if (clg_ref->type == NULL) {
CLG_logref_init(clg_ref);
}
return clg_ref->type->ctx->use_color;
}
/** \} */