libsheepy

C lib for handling text files, strings and json like data structure with an object oriented system
git clone https://spartatek.se/git/libsheepy.git
Log | Files | Refs | README | LICENSE

commit 2f48d0c03380b405da58ccf180820374c87d6f80
parent 6497a590ac1cc8da890c34a5a0b779f6bc970ae7
Author: Remy Noulin <loader2x@gmail.com>
Date:   Tue, 26 Sep 2023 20:10:58 +0200

remove extra escape codes in LOG_VOID mode

The escape codes are not visible but shouldn't be printed out.

release/libsheepy.c | 20 +++++++++++---------
release/libsheepy.h |  2 +-
src/libsheepy.c     | 20 +++++++++++---------
src/libsheepy.h     |  2 +-
4 files changed, 24 insertions(+), 20 deletions(-)

Diffstat:
Mrelease/libsheepy.c | 20+++++++++++---------
Mrelease/libsheepy.h | 2+-
Msrc/libsheepy.c | 20+++++++++++---------
Msrc/libsheepy.h | 2+-
4 files changed, 24 insertions(+), 20 deletions(-)

diff --git a/release/libsheepy.c b/release/libsheepy.c @@ -1258,7 +1258,7 @@ void _pLog(int loglevel, const char *file, const char *func, int line, const cha } // set console color for printing the tag - if (_logToStdout && keepAnsiColors) { + if (_logToStdout && keepAnsiColors && _log_current_mode != LOG_VOID) { switch (loglevel) { case LOG_EMERGENCY: printf(BLD RED); @@ -1333,18 +1333,20 @@ void _pLog(int loglevel, const char *file, const char *func, int line, const cha } } - int tagSymbols = logSymbols != LOG_INVALID_MODE ? logSymbols : _log_current_mode; - - // print the log tag int firstLogFile = _logToStdout ? 0 : 1; int i; - for (i=firstLogFile; i < _current_log_file; i++) { - fprintf(_logging_files[i], "%s", log_tags[tagSymbols][loglevel]); - } + if (_log_current_mode != LOG_VOID) { + int tagSymbols = logSymbols != LOG_INVALID_MODE ? logSymbols : _log_current_mode; + + // print the log tag + for (i=firstLogFile; i < _current_log_file; i++) { + fprintf(_logging_files[i], "%s", log_tags[tagSymbols][loglevel]); + } - if (_logToStdout) { - printf(RST); + if (_logToStdout) { + printf(RST); } + } /* logVar(_log_current_mode, "d"); */ /* puts(log_tags[_log_current_mode][loglevel]); */ diff --git a/release/libsheepy.h b/release/libsheepy.h @@ -98,7 +98,7 @@ // version accoring to the version package: Release.Major.minor.patch // https://noulin.net/version/file/README.md.html -#define LIBSHEEPY_VERSION "2.2.13" +#define LIBSHEEPY_VERSION "2.2.13.1" #ifndef SH_PREFIX #define SH_PREFIX(NAME) NAME diff --git a/src/libsheepy.c b/src/libsheepy.c @@ -1314,7 +1314,7 @@ void _pLog(int loglevel, const char *file, const char *func, int line, const cha } // set console color for printing the tag - if (_logToStdout && keepAnsiColors) { + if (_logToStdout && keepAnsiColors && _log_current_mode != LOG_VOID) { switch (loglevel) { case LOG_EMERGENCY: printf(BLD RED); @@ -1389,18 +1389,20 @@ void _pLog(int loglevel, const char *file, const char *func, int line, const cha } } - int tagSymbols = logSymbols != LOG_INVALID_MODE ? logSymbols : _log_current_mode; - - // print the log tag int firstLogFile = _logToStdout ? 0 : 1; int i; - for (i=firstLogFile; i < _current_log_file; i++) { - fprintf(_logging_files[i], "%s", log_tags[tagSymbols][loglevel]); - } + if (_log_current_mode != LOG_VOID) { + int tagSymbols = logSymbols != LOG_INVALID_MODE ? logSymbols : _log_current_mode; + + // print the log tag + for (i=firstLogFile; i < _current_log_file; i++) { + fprintf(_logging_files[i], "%s", log_tags[tagSymbols][loglevel]); + } - if (_logToStdout) { - printf(RST); + if (_logToStdout) { + printf(RST); } + } /* logVar(_log_current_mode, "d"); */ /* puts(log_tags[_log_current_mode][loglevel]); */ diff --git a/src/libsheepy.h b/src/libsheepy.h @@ -98,7 +98,7 @@ // version accoring to the version package: Release.Major.minor.patch // https://noulin.net/version/file/README.md.html -#define LIBSHEEPY_VERSION "2.2.13" +#define LIBSHEEPY_VERSION "2.2.13.1" #ifndef SH_PREFIX #define SH_PREFIX(NAME) NAME