Skip to content

Commit 5c5a14b

Browse files
author
Alexey Pleshakov
committed
added verbosity_DEBUG to loguru
1 parent 2ff70dd commit 5c5a14b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+91
-60
lines changed

server/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,18 @@ SET(GCC_COVERAGE_LINK_FLAGS "-lpthread -ldl")
4242
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GCC_COVERAGE_LINK_FLAGS}")
4343

4444
get_filename_component(UTBOT_DIR ${PROJECT_SOURCE_DIR} DIRECTORY)
45+
4546
set(LOGGER_DIR "${UTBOT_DIR}/loguru")
46-
add_library(loguru ${LOGGER_DIR}/loguru.cpp)
47-
include_directories(${LOGGER_DIR})
47+
set(LOGGER_AUX_DIR "${PROJECT_SOURCE_DIR}/logger-aux")
48+
add_library(loguru ${LOGGER_DIR}/loguru.cpp ${LOGGER_AUX_DIR}/loguru_debug.cpp)
49+
target_include_directories(loguru PUBLIC ${LOGGER_DIR})
50+
include_directories(${LOGGER_AUX_DIR})
4851

4952
set(JSON_PATH "${UTBOT_DIR}/json")
5053
include_directories(${JSON_PATH}/src)
5154

5255
set(TSL_PATH "${UTBOT_DIR}/ordered-map")
56+
message("tsl include from here: ${TSL_PATH}/include")
5357
include_directories(${TSL_PATH}/include)
5458

5559
set(PARALLEL_HASHMAP_PATH "${UTBOT_DIR}/parallel-hashmap")

server/logger-aux/loguru.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* Copyright (c) Huawei Technologies Co., Ltd. 2012-2021. All rights reserved.
3+
*/
4+
5+
#ifndef UNITTESTBOT_LOGURU_H
6+
#define UNITTESTBOT_LOGURU_H
7+
#include "loguru.hpp"
8+
9+
namespace loguru {
10+
extern Verbosity Verbosity_DEBUG;
11+
}
12+
#endif //UNITTESTBOT_LOGURU_H

server/logger-aux/loguru_debug.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*
2+
* Copyright (c) Huawei Technologies Co., Ltd. 2012-2021. All rights reserved.
3+
*/
4+
5+
#include "loguru.hpp"
6+
7+
namespace loguru {
8+
Verbosity Verbosity_DEBUG = Verbosity_1;
9+
}

server/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include "Server.h"
66
#include "utils/CLIUtils.h"
77

8-
#include "loguru.hpp"
8+
#include "loguru.h"
99

1010
#include <cstdlib>
1111

server/src/FeaturesFilter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include "clang-utils/ClangUtils.h"
99
#include "exceptions/NoTestGeneratedException.h"
1010

11-
#include "loguru.hpp"
11+
#include "loguru.h"
1212

1313
static void updateIfNotCompleteType(types::TypeSupport &typeSupport,
1414
bool condition,

server/src/GTestLogger.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#include "GTestLogger.h"
66

7-
#include "loguru.hpp"
7+
#include "loguru.h"
88

99
void GTestLogger::log(std::string_view message) {
1010
LOG_S(INFO) << message;

server/src/KleeGenerator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include "utils/MakefileUtils.h"
1717
#include "utils/SanitizerUtils.h"
1818

19-
#include "loguru.hpp"
19+
#include "loguru.h"
2020

2121
using namespace tests;
2222

server/src/KleeRunner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include "utils/KleeUtils.h"
1414
#include "utils/LogUtils.h"
1515

16-
#include "loguru.hpp"
16+
#include "loguru.h"
1717

1818
#include <unistd.h>
1919
#include <utility>

server/src/Paths.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#ifndef UNITTESTBOT_PATHS_H
66
#define UNITTESTBOT_PATHS_H
77

8-
#include "loguru.hpp"
8+
#include "loguru.h"
99

1010
#include "Language.h"
1111
#include "ProjectContext.h"

server/src/Server.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,10 @@ void Server::logToClient(void *channel, const loguru::Message &message) {
320320
if (data == nullptr) {
321321
throw BaseException("Couldn't handle logging to client, data is null");
322322
}
323-
if (std::string(message.thread_name) == data->client &&
323+
vector <char> thread_name(data->client.size());
324+
loguru::get_thread_name(thread_name.data(), sizeof(data->client.size()), false);
325+
326+
if (std::string(thread_name.begin(), thread_name.end()) == data->client &&
324327
std::string(message.filename) != std::string(GTestLogger::fileName())) {
325328
LogEntry logEntry;
326329
std::string extractedMessage = extractMessage(message);
@@ -335,7 +338,10 @@ void Server::gtestLog(void *channel, const loguru::Message &message) {
335338
if (data == nullptr) {
336339
throw BaseException("Can't interpret gtest log channel");
337340
}
338-
if (std::string(message.thread_name) == data->client &&
341+
vector <char> thread_name(data->client.size());
342+
loguru::get_thread_name(thread_name.data(), sizeof(data->client.size()), false);
343+
344+
if (std::string(thread_name.begin(), thread_name.end()) == data->client &&
339345
std::string(message.filename) == std::string(GTestLogger::fileName())) {
340346
LogEntry logEntry;
341347
logEntry.set_message(message.message);
@@ -366,9 +372,9 @@ Status Server::TestsGenServiceImpl::provideLoggingCallbacks(
366372
loguru::add_callback(callbackName.c_str(), handler, &data,
367373
loguru::get_verbosity_from_name(logLevel.c_str()));
368374
if (openFiles) {
369-
loguru::add_file(allLogPath.c_str(), client.c_str(), loguru::Append,
375+
loguru::add_file(allLogPath.c_str(), loguru::Append,
370376
loguru::Verbosity_MAX);
371-
loguru::add_file(latestLogPath.c_str(), client.c_str(), loguru::Truncate,
377+
loguru::add_file(latestLogPath.c_str(), loguru::Truncate,
372378
loguru::Verbosity_INFO);
373379
}
374380
holdLockFlag[callbackName] = true;

0 commit comments

Comments
 (0)