Skip to content

Commit

Permalink
Fixed typo
Browse files Browse the repository at this point in the history
  • Loading branch information
kala13x committed Jul 31, 2022
1 parent 8e1e27b commit 74dd738
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion example/example.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ int main()

/* Enable only time in output */
cfg.eDateControl = SLOG_TIME_ONLY;
cfg.nIdent = 1;
cfg.nIndent = 1;
slog_config_set(&cfg);

slogn("Simple note message");
Expand Down
File renamed without changes
File renamed without changes
20 changes: 10 additions & 10 deletions src/slog.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@ static void slog_unlock(slog_t *pSlog)
}
}

static const char *slog_get_ident(slog_flag_t eFlag)
static const char *slog_get_indent(slog_flag_t eFlag)
{
slog_config_t *pCfg = &g_slog.config;
if (!pCfg->nIdent) return SLOG_EMPTY;
if (!pCfg->nIndent) return SLOG_EMPTY;

switch (eFlag)
{
case SLOG_NOTAG:
return SLOG_IDENT;
return SLOG_INDENT;
case SLOG_NOTE:
case SLOG_INFO:
case SLOG_WARN:
Expand Down Expand Up @@ -203,17 +203,17 @@ static void slog_create_tag(char *pOut, size_t nSize, slog_flag_t eFlag, const c
slog_config_t *pCfg = &g_slog.config;
pOut[0] = SLOG_NUL;

const char *pIdent = slog_get_ident(eFlag);
const char *pIndent = slog_get_indent(eFlag);
const char *pTag = slog_get_tag(eFlag);

if (pTag == NULL)
{
snprintf(pOut, nSize, pIdent);
snprintf(pOut, nSize, pIndent);
return;
}

if (pCfg->eColorFormat != SLOG_COLORING_TAG) snprintf(pOut, nSize, "<%s>%s", pTag, pIdent);
else snprintf(pOut, nSize, "%s<%s>%s%s", pColor, pTag, SLOG_COLOR_RESET, pIdent);
if (pCfg->eColorFormat != SLOG_COLORING_TAG) snprintf(pOut, nSize, "<%s>%s", pTag, pIndent);
else snprintf(pOut, nSize, "%s<%s>%s%s", pColor, pTag, SLOG_COLOR_RESET, pIndent);
}

static void slog_create_tid(char *pOut, int nSize, uint8_t nTraceTid)
Expand Down Expand Up @@ -421,10 +421,10 @@ void slog_separator_set(const char *pFormat, ...)
slog_unlock(&g_slog);
}

void slog_ident(uint8_t nEnable)
void slog_indent(uint8_t nEnable)
{
slog_lock(&g_slog);
g_slog.config.nIdent = nEnable;
g_slog.config.nIndent = nEnable;
slog_unlock(&g_slog);
}

Expand Down Expand Up @@ -453,7 +453,7 @@ void slog_init(const char* pName, uint16_t nFlags, uint8_t nTdSafe)
pCfg->nToScreen = 1;
pCfg->nUseHeap = 0;
pCfg->nToFile = 0;
pCfg->nIdent = 0;
pCfg->nIndent = 0;
pCfg->nFlush = 0;
pCfg->nFlags = nFlags;

Expand Down
6 changes: 3 additions & 3 deletions src/slog.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ extern "C" {

#define SLOG_NAME_DEFAULT "slog"
#define SLOG_NEWLINE "\n"
#define SLOG_IDENT " "
#define SLOG_INDENT " "
#define SLOG_SPACE " "
#define SLOG_EMPTY ""
#define SLOG_NUL '\0'
Expand Down Expand Up @@ -162,7 +162,7 @@ typedef struct SLogConfig {
uint8_t nToScreen; // Enable screen logging
uint8_t nUseHeap; // Use dynamic allocation
uint8_t nToFile; // Enable file logging
uint8_t nIdent; // Enable identation
uint8_t nIndent; // Enable indentations
uint8_t nFlush; // Flush stdout after screen log
uint16_t nFlags; // Allowed log level flags

Expand All @@ -177,7 +177,7 @@ void slog_config_set(slog_config_t *pCfg);

void slog_separator_set(const char *pFormat, ...);
void slog_callback_set(slog_cb_t callback, void *pContext);
void slog_ident(uint8_t nEnable);
void slog_indent(uint8_t nEnable);

void slog_enable(slog_flag_t eFlag);
void slog_disable(slog_flag_t eFlag);
Expand Down

0 comments on commit 74dd738

Please sign in to comment.