mirror of
https://github.com/pocoproject/poco.git
synced 2025-04-21 16:28:18 +02:00
trunk/branch integration: Message source
This commit is contained in:
parent
17d3698815
commit
34d3e64dba
@ -36,7 +36,9 @@
|
|||||||
|
|
||||||
#include "Poco/Message.h"
|
#include "Poco/Message.h"
|
||||||
#include "Poco/Exception.h"
|
#include "Poco/Exception.h"
|
||||||
|
#if !defined(POCO_VXWORKS)
|
||||||
#include "Poco/Process.h"
|
#include "Poco/Process.h"
|
||||||
|
#endif
|
||||||
#include "Poco/Thread.h"
|
#include "Poco/Thread.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
@ -48,6 +50,8 @@ Message::Message():
|
|||||||
_prio(PRIO_FATAL),
|
_prio(PRIO_FATAL),
|
||||||
_tid(0),
|
_tid(0),
|
||||||
_pid(0),
|
_pid(0),
|
||||||
|
_file(0),
|
||||||
|
_line(0),
|
||||||
_pMap(0)
|
_pMap(0)
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
@ -60,6 +64,22 @@ Message::Message(const std::string& source, const std::string& text, Priority pr
|
|||||||
_prio(prio),
|
_prio(prio),
|
||||||
_tid(0),
|
_tid(0),
|
||||||
_pid(0),
|
_pid(0),
|
||||||
|
_file(0),
|
||||||
|
_line(0),
|
||||||
|
_pMap(0)
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Message::Message(const std::string& source, const std::string& text, Priority prio, const char* file, int line):
|
||||||
|
_source(source),
|
||||||
|
_text(text),
|
||||||
|
_prio(prio),
|
||||||
|
_tid(0),
|
||||||
|
_pid(0),
|
||||||
|
_file(file),
|
||||||
|
_line(line),
|
||||||
_pMap(0)
|
_pMap(0)
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
@ -73,7 +93,9 @@ Message::Message(const Message& msg):
|
|||||||
_time(msg._time),
|
_time(msg._time),
|
||||||
_tid(msg._tid),
|
_tid(msg._tid),
|
||||||
_thread(msg._thread),
|
_thread(msg._thread),
|
||||||
_pid(msg._pid)
|
_pid(msg._pid),
|
||||||
|
_file(msg._file),
|
||||||
|
_line(msg._line)
|
||||||
{
|
{
|
||||||
if (msg._pMap)
|
if (msg._pMap)
|
||||||
_pMap = new StringMap(*msg._pMap);
|
_pMap = new StringMap(*msg._pMap);
|
||||||
@ -89,7 +111,9 @@ Message::Message(const Message& msg, const std::string& text):
|
|||||||
_time(msg._time),
|
_time(msg._time),
|
||||||
_tid(msg._tid),
|
_tid(msg._tid),
|
||||||
_thread(msg._thread),
|
_thread(msg._thread),
|
||||||
_pid(msg._pid)
|
_pid(msg._pid),
|
||||||
|
_file(msg._file),
|
||||||
|
_line(msg._line)
|
||||||
{
|
{
|
||||||
if (msg._pMap)
|
if (msg._pMap)
|
||||||
_pMap = new StringMap(*msg._pMap);
|
_pMap = new StringMap(*msg._pMap);
|
||||||
@ -106,7 +130,9 @@ Message::~Message()
|
|||||||
|
|
||||||
void Message::init()
|
void Message::init()
|
||||||
{
|
{
|
||||||
|
#if !defined(POCO_VXWORKS)
|
||||||
_pid = Process::id();
|
_pid = Process::id();
|
||||||
|
#endif
|
||||||
Thread* pThread = Thread::current();
|
Thread* pThread = Thread::current();
|
||||||
if (pThread)
|
if (pThread)
|
||||||
{
|
{
|
||||||
@ -137,6 +163,8 @@ void Message::swap(Message& msg)
|
|||||||
swap(_tid, msg._tid);
|
swap(_tid, msg._tid);
|
||||||
swap(_thread, msg._thread);
|
swap(_thread, msg._thread);
|
||||||
swap(_pid, msg._pid);
|
swap(_pid, msg._pid);
|
||||||
|
swap(_file, msg._file);
|
||||||
|
swap(_line, msg._line);
|
||||||
swap(_pMap, msg._pMap);
|
swap(_pMap, msg._pMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,6 +211,18 @@ void Message::setPid(long pid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Message::setSourceFile(const char* file)
|
||||||
|
{
|
||||||
|
_file = file;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Message::setSourceLine(int line)
|
||||||
|
{
|
||||||
|
_line = line;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const std::string& Message::operator [] (const std::string& param) const
|
const std::string& Message::operator [] (const std::string& param) const
|
||||||
{
|
{
|
||||||
if (_pMap)
|
if (_pMap)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user