Skip to content

Commit c07725a

Browse files
committed
Fixed logger.
1 parent a38d356 commit c07725a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

sources/logger.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Logger {
2121
template <typename... Args>
2222
static void trace(const char* label, const char* fmt, const Args&... args) {
2323
char buf[LOGGER_BUFFER_SIZE];
24-
buf[0] = 0;
24+
std::memset(buf, 0, LOGGER_BUFFER_SIZE);
2525
strcat(buf, "[{:12}] ");
2626
strcat(buf, fmt);
2727
Logger::_logger->trace(buf, label, args...);
@@ -30,7 +30,7 @@ class Logger {
3030
template <typename... Args>
3131
static void debug(const char* label, const char* fmt, const Args&... args) {
3232
char buf[LOGGER_BUFFER_SIZE];
33-
buf[0] = 0;
33+
std::memset(buf, 0, LOGGER_BUFFER_SIZE);
3434
strcat(buf, "[{:12}] ");
3535
strcat(buf, fmt);
3636
Logger::_logger->debug(buf, label, args...);
@@ -39,7 +39,7 @@ class Logger {
3939
template <typename... Args>
4040
static void info(const char* label, const char* fmt, const Args&... args) {
4141
char buf[LOGGER_BUFFER_SIZE];
42-
buf[0] = 0;
42+
std::memset(buf, 0, LOGGER_BUFFER_SIZE);
4343
strcat(buf, "[{:12}] ");
4444
strcat(buf, fmt);
4545
Logger::_logger->info(buf, label, args...);
@@ -48,7 +48,7 @@ class Logger {
4848
template <typename... Args>
4949
static void warn(const char* label, const char* fmt, const Args&... args) {
5050
char buf[LOGGER_BUFFER_SIZE];
51-
buf[0] = 0;
51+
std::memset(buf, 0, LOGGER_BUFFER_SIZE);
5252
strcat(buf, "[{:12}] ");
5353
strcat(buf, fmt);
5454
Logger::_logger->warn(buf, label, args...);
@@ -57,7 +57,7 @@ class Logger {
5757
template <typename... Args>
5858
static void error(const char* label, const char* fmt, const Args&... args) {
5959
char buf[LOGGER_BUFFER_SIZE];
60-
buf[0] = 0;
60+
std::memset(buf, 0, LOGGER_BUFFER_SIZE);
6161
strcat(buf, "[{:12}] ");
6262
strcat(buf, fmt);
6363
Logger::_logger->error(buf, label, args...);
@@ -66,7 +66,7 @@ class Logger {
6666
template <typename... Args>
6767
static void critical(const char* label, const char* fmt, const Args&... args) {
6868
char buf[LOGGER_BUFFER_SIZE];
69-
buf[0] = 0;
69+
std::memset(buf, 0, LOGGER_BUFFER_SIZE);
7070
strcat(buf, "[{:12}] ");
7171
strcat(buf, fmt);
7272
Logger::_logger->critical(buf, label, args...);
@@ -87,7 +87,7 @@ template <typename... Args>
8787
std::string colored(const char* color, const char* fmt, const Args&... args) {
8888
if (Logger::isColorLogEnabled()) {
8989
char buf[20];
90-
buf[0] = 0;
90+
std::memset(buf, 0, 20);
9191
strcat(buf, "{}");
9292
strcat(buf, fmt);
9393
strcat(buf, "{}");

0 commit comments

Comments
 (0)