Add extracted tools: CitrineOS, OpenOCPP, ShapeShifter
- CitrineOS core extracted (CSMS OCPP 2.0.1) - OpenOCPP extracted (firmware OCPP 1.6J/2.0.1) - ShapeShifter library installed (pip install -e) - ShapeShifter specification extracted - EVerest extracted TODO updated with progress
This commit is contained in:
13
tools/EVerest-main/lib/everest/log/examples/CMakeLists.txt
Normal file
13
tools/EVerest-main/lib/everest/log/examples/CMakeLists.txt
Normal file
@@ -0,0 +1,13 @@
|
||||
find_package(Boost COMPONENTS program_options REQUIRED)
|
||||
|
||||
add_executable(main main.cpp)
|
||||
target_link_libraries(main
|
||||
PRIVATE
|
||||
everest::log
|
||||
Boost::program_options
|
||||
)
|
||||
|
||||
add_executable(test_trace test_trace.cpp)
|
||||
target_link_libraries(test_trace PRIVATE
|
||||
everest::log
|
||||
)
|
||||
18
tools/EVerest-main/lib/everest/log/examples/logging-verb.ini
Normal file
18
tools/EVerest-main/lib/everest/log/examples/logging-verb.ini
Normal file
@@ -0,0 +1,18 @@
|
||||
# for documentation on this file format see:
|
||||
# https://www.boost.org/doc/libs/1_54_0/libs/log/doc/html/log/detailed/utilities.html#log.detailed.utilities.setup.filter_formatter
|
||||
|
||||
[Core]
|
||||
DisableLogging=false
|
||||
Filter="%Severity% >= VERB"
|
||||
|
||||
[Sinks.Console]
|
||||
Destination=Console
|
||||
# Filter="%Target% contains \"MySink1\""
|
||||
Format="%TimeStamp% \033[1;32m%Process%\033[0m [\033[1;32m%ProcessID%\033[0m] [%Severity%] {\033[1;34m%ThreadID%\033[0m} \033[1;36m%function%\033[0m \033[1;30m%file%:\033[0m\033[1;32m%line%\033[0m: %Message%"
|
||||
Asynchronous=false
|
||||
AutoFlush=true
|
||||
SeverityStringColorDebug="\033[1;30m"
|
||||
SeverityStringColorInfo="\033[1;37m"
|
||||
SeverityStringColorWarning="\033[1;33m"
|
||||
SeverityStringColorError="\033[1;31m"
|
||||
SeverityStringColorCritical="\033[1;35m"
|
||||
18
tools/EVerest-main/lib/everest/log/examples/logging.ini
Normal file
18
tools/EVerest-main/lib/everest/log/examples/logging.ini
Normal file
@@ -0,0 +1,18 @@
|
||||
# for documentation on this file format see:
|
||||
# https://www.boost.org/doc/libs/1_54_0/libs/log/doc/html/log/detailed/utilities.html#log.detailed.utilities.setup.filter_formatter
|
||||
|
||||
[Core]
|
||||
DisableLogging=false
|
||||
Filter="%Severity% >= DEBG"
|
||||
|
||||
[Sinks.Console]
|
||||
Destination=Console
|
||||
# Filter="%Target% contains \"MySink1\""
|
||||
Format="%TimeStamp% \033[1;32m%Process%\033[0m [\033[1;32m%ProcessID%\033[0m] [%Severity%] {\033[1;34m%ThreadID%\033[0m} \033[1;36m%function%\033[0m \033[1;30m%file%:\033[0m\033[1;32m%line%\033[0m: %Message%"
|
||||
Asynchronous=false
|
||||
AutoFlush=true
|
||||
SeverityStringColorDebug="\033[1;30m"
|
||||
SeverityStringColorInfo="\033[1;37m"
|
||||
SeverityStringColorWarning="\033[1;33m"
|
||||
SeverityStringColorError="\033[1;31m"
|
||||
SeverityStringColorCritical="\033[1;35m"
|
||||
66
tools/EVerest-main/lib/everest/log/examples/main.cpp
Normal file
66
tools/EVerest-main/lib/everest/log/examples/main.cpp
Normal file
@@ -0,0 +1,66 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
#include <everest/logging.hpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <boost/exception/diagnostic_information.hpp>
|
||||
#include <boost/program_options.hpp>
|
||||
|
||||
namespace po = boost::program_options;
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
po::options_description desc("EVerest::log example");
|
||||
desc.add_options()("help,h", "produce help message");
|
||||
desc.add_options()("logconf", po::value<std::string>(), "The path to a custom logging.ini");
|
||||
desc.add_options()("logconfreinit", po::value<std::string>(), "The path to a custom logging.ini");
|
||||
|
||||
po::variables_map vm;
|
||||
po::store(po::parse_command_line(argc, argv, desc), vm);
|
||||
po::notify(vm);
|
||||
|
||||
if (vm.count("help") != 0) {
|
||||
std::cout << desc << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
// initialize logging as early as possible
|
||||
Everest::Logging::init();
|
||||
// since we initialized without any config the following messages should not logged at all:
|
||||
EVLOG_verbose << "This is a VERBOSE message.";
|
||||
EVLOG_debug << "This is a DEBUG message.";
|
||||
EVLOG_info << "This is a INFO message.";
|
||||
EVLOG_warning << "This is a WARNING message.";
|
||||
EVLOG_error << "This is a ERROR message.";
|
||||
EVLOG_critical << "This is a CRITICAL message.";
|
||||
|
||||
std::string logging_config = "logging.ini";
|
||||
if (vm.count("logconf") != 0) {
|
||||
logging_config = vm["logconf"].as<std::string>();
|
||||
}
|
||||
Everest::Logging::init(logging_config, "hello there");
|
||||
|
||||
EVLOG_debug << "logging_config was set to " << logging_config;
|
||||
|
||||
EVLOG_verbose << "This is a VERBOSE message.";
|
||||
EVLOG_debug << "This is a DEBUG message.";
|
||||
EVLOG_info << "This is a INFO message.";
|
||||
EVLOG_warning << "This is a WARNING message.";
|
||||
EVLOG_error << "This is a ERROR message.";
|
||||
EVLOG_critical << "This is a CRITICAL message.";
|
||||
|
||||
std::string logging_config_reinit = "logging_reinit.ini";
|
||||
if (vm.count("logconfreinit") != 0) {
|
||||
logging_config_reinit = vm["logconfreinit"].as<std::string>();
|
||||
}
|
||||
Everest::Logging::init(logging_config_reinit, "hello reinit");
|
||||
|
||||
EVLOG_verbose << "This is a VERBOSE message after reinit.";
|
||||
EVLOG_debug << "This is a DEBUG message after reinit.";
|
||||
EVLOG_info << "This is a INFO message after reinit.";
|
||||
EVLOG_warning << "This is a WARNING message after reinit.";
|
||||
EVLOG_error << "This is a ERROR message after reinit.";
|
||||
EVLOG_critical << "This is a CRITICAL message after reinit.";
|
||||
|
||||
return 0;
|
||||
}
|
||||
47
tools/EVerest-main/lib/everest/log/examples/test_trace.cpp
Normal file
47
tools/EVerest-main/lib/everest/log/examples/test_trace.cpp
Normal file
@@ -0,0 +1,47 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright 2020 - 2022 Pionix GmbH and Contributors to EVerest
|
||||
#include <everest/logging.hpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
class TraceTest {
|
||||
public:
|
||||
static void do_trace(bool) {
|
||||
std::cout << Everest::Logging::trace();
|
||||
}
|
||||
};
|
||||
|
||||
void bax() {
|
||||
std::cout << Everest::Logging::trace();
|
||||
}
|
||||
|
||||
bool baz(const char* str) {
|
||||
auto lambda = [&str](int& i) {
|
||||
i++;
|
||||
|
||||
bax();
|
||||
};
|
||||
|
||||
int test = 41;
|
||||
|
||||
lambda(test);
|
||||
return true;
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
void bar(int) {
|
||||
baz("Please trace ...");
|
||||
}
|
||||
}
|
||||
|
||||
void foo() {
|
||||
bar(85);
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
TraceTest::do_trace(true);
|
||||
|
||||
foo();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user