log2 replaced with Log2 inline function.
This commit is contained in:
@@ -308,25 +308,25 @@ void BusLoop::analyseCycData()
|
||||
static bool skipfirst = false;
|
||||
|
||||
if (skipfirst == true) {
|
||||
L.log(bus, trace, "%s", m_sstr.getDataStr().c_str());
|
||||
L.log(cyc, trace, "%s", m_sstr.getDataStr().c_str());
|
||||
|
||||
int index = m_commands->storeCycData(m_sstr.getDataStr());
|
||||
|
||||
if (index == -1) {
|
||||
L.log(bus, debug, " command not found");
|
||||
L.log(cyc, debug, " command not found");
|
||||
}
|
||||
else if (index == -2) {
|
||||
L.log(bus, debug, " no commands defined");
|
||||
L.log(cyc, debug, " no commands defined");
|
||||
}
|
||||
else if (index == -3) {
|
||||
L.log(bus, debug, " search skipped - string too short");
|
||||
L.log(cyc, debug, " search skipped - string too short");
|
||||
}
|
||||
else {
|
||||
std::string tmp;
|
||||
tmp += (*m_commands)[index][1];
|
||||
tmp += " ";
|
||||
tmp += (*m_commands)[index][2];
|
||||
L.log(bus, event, " cycle [%4d] %s", index, tmp.c_str());
|
||||
L.log(cyc, event, " cycle [%4d] %s", index, tmp.c_str());
|
||||
}
|
||||
|
||||
// collect Slave address
|
||||
|
||||
@@ -29,11 +29,14 @@
|
||||
#include <unistd.h>
|
||||
|
||||
/** static char array with logging area names */
|
||||
static const char* AreaNames[Size_of_Areas] = { "bas", "net", "bus" };
|
||||
static const char* AreaNames[Size_of_Areas] = { "bas", "net", "bus", "cyc" };
|
||||
|
||||
/** static char array with logging level names */
|
||||
static const char* LevelNames[Size_of_Level] = { "error", "event", "trace", "debug" };
|
||||
|
||||
/** inline function of log2 */
|
||||
inline double Log2(double n) { return log(n) / log(2); }
|
||||
|
||||
int calcAreas(const std::string areas)
|
||||
{
|
||||
int m_areas = 0;
|
||||
@@ -120,7 +123,7 @@ void* LogSink::run()
|
||||
void LogConsole::write(const LogMessage& message) const
|
||||
{
|
||||
std::cout << message.getTime() << " ["
|
||||
<< AreaNames[(int)log2(message.getArea())] << " "
|
||||
<< AreaNames[(int)Log2(message.getArea())] << " "
|
||||
<< LevelNames[message.getLevel()] << "] "
|
||||
<< message.getText() << std::endl;
|
||||
}
|
||||
@@ -133,7 +136,7 @@ void LogFile::write(const LogMessage& message) const
|
||||
|
||||
if (file.is_open() == true) {
|
||||
file << message.getTime() << " ["
|
||||
<< AreaNames[(int)log2(message.getArea())] << " "
|
||||
<< AreaNames[(int)Log2(message.getArea())] << " "
|
||||
<< LevelNames[message.getLevel()] << "] "
|
||||
<< message.getText() << std::endl;
|
||||
file.close();
|
||||
|
||||
@@ -33,8 +33,9 @@ enum AreasType {
|
||||
bas=1, // basis
|
||||
net=2, // network
|
||||
bus=4, // ebus
|
||||
all=7, // type for all subsystems
|
||||
Size_of_Areas=3, // number of possible areas
|
||||
cyc=8, // cycle
|
||||
all=15, // type for all subsystems
|
||||
Size_of_Areas=4, // number of possible areas
|
||||
};
|
||||
|
||||
/** available logging levels */
|
||||
|
||||
Reference in New Issue
Block a user