-
Notifications
You must be signed in to change notification settings - Fork 1
LKLogger
LKLogger
class is logger manager for lilak. It contains 7 different categories and can print out to logger file with/without printing out to the screen. In general, LKLogger
should be used inside all the project tasks and containers.
-
cout
: This is equilivalent tostd::cout
test
info
-
list(0)
: list catches an list index and print out using the index warning
error
-
debug
:debug
category is special as it prints out line number and full file path. One can copy and paste line just aftervim
command, to open and go directly to the line where message was produced.
There are two logger types.
First logger type is lilak logger made to use inside the task and container class, where they have a member fName
. Macros for this type start with keyword lk
:
lk_cout
,
lk_test
,
lk_info
,
lk_list(0)
,
lk_warning
,
lk_error
,
lk_debug
Second logger type is general logger where you can use them anywhere. Macros for this type start with keyword e
:
e_cout
,
e_test
,
e_info
,
e_list(0)
,
e_warning
,
e_error
,
e_debug
Follwing macro print out 7 different logger message to the screen and to the file testing_logger.log
.
The macro lk_logger(logger_file_name)
creates logger file. Note that the logger also works withougt the logger file.
#include "LKLogger.h"
void run_logger()
{
lk_logger("testing_logger.log");
e_cout << "This is message using e_cout " << endl;
e_test << "This is message using e_test " << endl;
e_info << "This is message using e_info " << endl;
e_list(0) << "This is message using e_list(0)" << endl;
e_warning << "This is message using e_warning" << endl;
e_error << "This is message using e_error " << endl;
e_debug << "This is message using e_debug " << endl;
}
output:
> root run_logger.C
root [0]
Processing run_logger.C...
Log file is set: testing_logger.log
This is message using e_cout
test> This is message using e_test
info> This is message using e_info
0. This is message using e_list(0)
warn> This is message using e_warning
error> This is message using e_error
+42 /home/lilak/source/base/temp/run_logger.C # This is message using e_debug
root [1]
Using lk_set_message(false)
will turn all the message off.
#include "LKLogger.h"
void run_logger()
{
lk_logger("testing_logger.log");
lk_set_message(false);
e_cout << "This is message using e_cout " << endl;
e_test << "This is message using e_test " << endl;
e_info << "This is message using e_info " << endl;
e_list(0) << "This is message using e_list(0)" << endl;
e_warning << "This is message using e_warning" << endl;
e_error << "This is message using e_error " << endl;
e_debug << "This is message using e_debug " << endl;
}
output:
> root run_logger.C
root [0]
Processing run_logger.C...
Log file is set: testing_logger.log
root [1]
One can set message from specific categories on or off using lk_set_[category](true/false)
.
#include "LKLogger.h"
void run_logger()
{
lk_logger("testing_logger.log");
lk_set_cout(true);
lk_set_test(false);
lk_set_info(true);
lk_set_list(false);
lk_set_warning(false);
lk_set_error(false);
lk_set_debug(false);
e_cout << "This is message using e_cout " << endl;
e_test << "This is message using e_test " << endl;
e_info << "This is message using e_info " << endl;
e_list(0) << "This is message using e_list(0)" << endl;
e_warning << "This is message using e_warning" << endl;
e_error << "This is message using e_error " << endl;
e_debug << "This is message using e_debug " << endl;
}
output:
> root run_logger.C
root [0]
Processing run_logger.C...
Log file is set: testing_logger.log
This is message using e_cout
info> This is message using e_info
root [1]
lilak
Stear
Project