Symulacja NAT na przedmiot Symulacje Komputerowe
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

82 lines
1.2 KiB

/*
* Log.cpp
*
* Created on: 16.01.2017
* Author: piotrek
*/
#include "Log.h"
Log::Log()
{
this->color = WHITE;
this->delimiter = "";
this->lineNumber = 0;
this->objectName = NULL;
}
LOG_COLOR Log::getColor() const
{
return color;
}
void Log::setColor(LOG_COLOR color)
{
this->color = color;
}
const string& Log::getDelimiter() const
{
return delimiter;
}
void Log::setDelimiter(const string& delimiter)
{
this->delimiter = delimiter;
}
int Log::getLineNumber() const
{
return lineNumber;
}
void Log::setLineNumber(int lineNumber)
{
this->lineNumber = lineNumber;
}
string* Log::getObjectName() const
{
return objectName;
}
void Log::setObjectName(string* objectName)
{
this->objectName = objectName;
}
void Log::print(string msg)
{
if (this->getObjectName() == NULL)
return;
move(this->getLineNumber(), 0);
clrtoeol();
if(has_colors())
attron(COLOR_PAIR(this->getColor()));
printw("%s:%s%s", this->getObjectName()->c_str(), this->getDelimiter().c_str(), msg.c_str());
if(has_colors())
attroff(COLOR_PAIR(this->getColor()));
move(0, 0);
}
void Log::setLogParams(int lineNumber, LOG_COLOR color, string delimiter)
{
this->setLineNumber(lineNumber);
this->setColor(color);
this->setDelimiter(delimiter);
}