style: update pl_log.h channel formats v1.0.2
All checks were successful
Tests / Ubuntu (push) Successful in 9s
All checks were successful
Tests / Ubuntu (push) Successful in 9s
This commit is contained in:
parent
4d9a7a2be6
commit
cf4954ded3
29
pl_log.h
29
pl_log.h
@ -13,8 +13,8 @@
|
||||
*/
|
||||
|
||||
// library version (format XYYZZ)
|
||||
#define PL_LOG_VERSION "1.0.0"
|
||||
#define PL_LOG_VERSION_NUM 10000
|
||||
#define PL_LOG_VERSION "1.0.2"
|
||||
#define PL_LOG_VERSION_NUM 10002
|
||||
|
||||
/*
|
||||
Index of this file:
|
||||
@ -662,13 +662,18 @@ pl__get_new_log_entry(uint64_t uID)
|
||||
// check if overflow reallocation is needed
|
||||
if(tPChannel->uEntryCount == tPChannel->uEntryCapacity)
|
||||
{
|
||||
uint64_t uNewCapacity = tPChannel->uEntryCapacity * 2;
|
||||
if(uNewCapacity == 0)
|
||||
uNewCapacity = 512;
|
||||
plLogEntry* sbtOldEntries = tPChannel->ptEntries;
|
||||
tPChannel->ptEntries = (plLogEntry*)PL_LOG_ALLOC(sizeof(plLogEntry) * tPChannel->uEntryCapacity * 2);
|
||||
memset(tPChannel->ptEntries, 0, sizeof(plLogEntry) * tPChannel->uEntryCapacity * 2);
|
||||
tPChannel->ptEntries = (plLogEntry*)PL_LOG_ALLOC(sizeof(plLogEntry) * uNewCapacity);
|
||||
memset(tPChannel->ptEntries, 0, sizeof(plLogEntry) * uNewCapacity);
|
||||
|
||||
// copy old values
|
||||
memcpy(tPChannel->ptEntries, sbtOldEntries, sizeof(plLogEntry) * tPChannel->uEntryCapacity);
|
||||
tPChannel->uEntryCapacity *= 2;
|
||||
if(tPChannel->uEntryCapacity > 0)
|
||||
memcpy(tPChannel->ptEntries, sbtOldEntries, sizeof(plLogEntry) * tPChannel->uEntryCapacity);
|
||||
|
||||
tPChannel->uEntryCapacity = uNewCapacity;
|
||||
|
||||
PL_LOG_FREE(sbtOldEntries);
|
||||
}
|
||||
@ -923,13 +928,13 @@ pl__log_debug(uint64_t uID, const char* pcMessage)
|
||||
void
|
||||
pl__log_info(uint64_t uID, const char* pcMessage)
|
||||
{
|
||||
PL__LOG_LEVEL_MACRO(PL_LOG_LEVEL_INFO, "[INFO ]", 7)
|
||||
PL__LOG_LEVEL_MACRO(PL_LOG_LEVEL_INFO, "[INFO] ", 7)
|
||||
}
|
||||
|
||||
void
|
||||
pl__log_warn(uint64_t uID, const char* pcMessage)
|
||||
{
|
||||
PL__LOG_LEVEL_MACRO(PL_LOG_LEVEL_WARN, "[WARN ]", 7)
|
||||
PL__LOG_LEVEL_MACRO(PL_LOG_LEVEL_WARN, "[WARN] ", 7)
|
||||
}
|
||||
|
||||
void
|
||||
@ -1166,7 +1171,7 @@ pl__log_info_va(uint64_t uID, const char* cPFormat, va_list args)
|
||||
printf(PL_LOG_INFO_BG_COLOR);
|
||||
#endif
|
||||
|
||||
printf("[INFO ] (%s) ", tPChannel->pcName);
|
||||
printf("[INFO] (%s) ", tPChannel->pcName);
|
||||
char dest[PL_LOG_MAX_LINE_SIZE];
|
||||
va_list parm_copy;
|
||||
va_copy(parm_copy, args);
|
||||
@ -1174,7 +1179,7 @@ pl__log_info_va(uint64_t uID, const char* cPFormat, va_list args)
|
||||
printf("%s%s\n", dest, PL_LOG_POP_CODE);
|
||||
va_end(parm_copy);
|
||||
}
|
||||
PL__LOG_LEVEL_VA_BUFFER_MACRO(PL_LOG_LEVEL_INFO, "[INFO ]", 7)
|
||||
PL__LOG_LEVEL_VA_BUFFER_MACRO(PL_LOG_LEVEL_INFO, "[INFO] ", 7)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1204,7 +1209,7 @@ pl__log_warn_va(uint64_t uID, const char* cPFormat, va_list args)
|
||||
printf(PL_LOG_WARN_BG_COLOR);
|
||||
#endif
|
||||
|
||||
printf("[WARN ] (%s) ", tPChannel->pcName);
|
||||
printf("[WARN] (%s) ", tPChannel->pcName);
|
||||
char dest[PL_LOG_MAX_LINE_SIZE];
|
||||
va_list parm_copy;
|
||||
va_copy(parm_copy, args);
|
||||
@ -1212,7 +1217,7 @@ pl__log_warn_va(uint64_t uID, const char* cPFormat, va_list args)
|
||||
printf("%s%s\n", dest, PL_LOG_POP_CODE);
|
||||
va_end(parm_copy);
|
||||
}
|
||||
PL__LOG_LEVEL_VA_BUFFER_MACRO(PL_LOG_LEVEL_WARN, "[WARN ]", 7)
|
||||
PL__LOG_LEVEL_VA_BUFFER_MACRO(PL_LOG_LEVEL_WARN, "[WARN] ", 7)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user