updated to the new pikotools api (changes in Log)

This commit is contained in:
Tomasz Sowa 2021-06-24 21:17:03 +02:00
parent bf1f0954b9
commit b6340a30d2
10 changed files with 38 additions and 28 deletions

View File

@ -68,8 +68,8 @@ App::App()
file_log.set_synchro(&synchro); file_log.set_synchro(&synchro);
file_log.set_time_zones(&system.time_zones); file_log.set_time_zones(&system.time_zones);
log.SetLogBuffer(&log_buffer); log.set_log_buffer(&log_buffer);
log.SetFileLog(&file_log); log.set_file_log(&file_log);
// objects dependency for main thread // objects dependency for main thread
winix_base.set_config(&config); winix_base.set_config(&config);

View File

@ -56,13 +56,13 @@ BaseThread::~BaseThread()
void BaseThread::set_main_log_buffer(pt::WTextStream * log_buffer) void BaseThread::set_main_log_buffer(pt::WTextStream * log_buffer)
{ {
main_log.SetLogBuffer(log_buffer); main_log.set_log_buffer(log_buffer);
} }
void BaseThread::set_main_file_log(pt::FileLog * file_log) void BaseThread::set_main_file_log(pt::FileLog * file_log)
{ {
main_log.SetFileLog(file_log); main_log.set_file_log(file_log);
} }

View File

@ -51,13 +51,13 @@ Config::Config()
void Config::SetFileLog(FileLog * file_log) void Config::SetFileLog(FileLog * file_log)
{ {
log.SetFileLog(file_log); log.set_file_log(file_log);
} }
void Config::SetLogBuffer(pt::WTextStream * log_buffer) void Config::SetLogBuffer(pt::WTextStream * log_buffer)
{ {
log.SetLogBuffer(log_buffer); log.set_log_buffer(log_buffer);
} }

View File

@ -271,33 +271,33 @@ return *this;
/*
Log & Log::LogString(const std::string & value, size_t max_size) Log & Log::put_string(const std::string & value, size_t max_size)
{ {
pt::Log::LogString(value, max_size); pt::Log::put_string(value, max_size);
return *this; return *this;
} }
Log & Log::LogString(const std::wstring & value, size_t max_size) Log & Log::put_string(const std::wstring & value, size_t max_size)
{ {
pt::Log::LogString(value, max_size); pt::Log::put_string(value, max_size);
return *this; return *this;
} }
Log & Log::LogBinary(const char * blob, size_t blob_len) Log & Log::put_binary_blob(const char * blob, size_t blob_len)
{ {
pt::Log::LogBinary(blob, blob_len); pt::Log::put_binary_blob(blob, blob_len);
return *this; return *this;
} }
Log & Log::LogBinary(const std::string & blob) Log & Log::put_binary_blob(const std::string & blob)
{ {
pt::Log::LogBinary(blob); pt::Log::put_binary_blob(blob);
return *this; return *this;
} }
*/

View File

@ -44,6 +44,8 @@
#include "logmanipulators.h" #include "logmanipulators.h"
#include "filelog.h" #include "filelog.h"
#include "log/log.h" #include "log/log.h"
#include "morm.h"
namespace Winix namespace Winix
@ -86,11 +88,13 @@ public:
Log & operator<<(const pt::TextStreamBase<char_type, stack_size, heap_block_size> & buf); Log & operator<<(const pt::TextStreamBase<char_type, stack_size, heap_block_size> & buf);
virtual Log & LogString(const std::string & value, size_t max_size); /*
virtual Log & LogString(const std::wstring & value, size_t max_size); virtual Log & put_string(const std::string & value, size_t max_size);
virtual Log & put_string(const std::wstring & value, size_t max_size);
virtual Log & LogBinary(const char * blob, size_t blob_len); virtual Log & put_binary_blob(const char * blob, size_t blob_len);
virtual Log & LogBinary(const std::string & blob); virtual Log & put_binary_blob(const std::string & blob);
*/
//virtual Log & SystemErr(int err); //virtual Log & SystemErr(int err);

View File

@ -69,8 +69,14 @@ enum LogManipulators
logend, logend,
logsave, logsave,
/*
* it is needed here?
*/
logendrequest, logendrequest,
/*
* it would be better to the SLog to have its own manipulators
*/
loginfo, loginfo,
logerror, logerror,
logwarning logwarning

View File

@ -256,7 +256,7 @@ void PostMultiParser::LogFirst(const std::string & to_log, size_t len)
log << "empty"; log << "empty";
log << "): \""; log << "): \"";
log.LogString(to_log, len); log.put_string(to_log, len);
log << "\"" << logend; log << "\"" << logend;
} }

View File

@ -5,7 +5,7 @@
*/ */
/* /*
* Copyright (c) 2008-2018, Tomasz Sowa * Copyright (c) 2008-2021, Tomasz Sowa
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -85,7 +85,7 @@ protected:
log << "(first " << log_value_size << " characters) "; log << "(first " << log_value_size << " characters) ";
log << "\""; log << "\"";
log.LogString(value, log_value_size); log.put_string(value, log_value_size);
log << "\" (size: " << value.size() << ")"; log << "\" (size: " << value.size() << ")";
} }

View File

@ -82,8 +82,8 @@ void ThreadManager::Add(BaseThread * pbase, const wchar_t * thread_name)
item.object->set_dependency(this); item.object->set_dependency(this);
// main log buffer (from the main thread) // main log buffer (from the main thread)
item.object->set_main_log_buffer(log.GetLogBuffer()); item.object->set_main_log_buffer(log.get_log_buffer());
item.object->set_main_file_log(log.GetFileLog()); item.object->set_main_file_log(log.get_file_log());
// the logger buffer and model_connector are different // the logger buffer and model_connector are different
item.object->set_log_buffer(&data.log_buffer); item.object->set_log_buffer(&data.log_buffer);
@ -200,7 +200,7 @@ void ThreadManager::StopAll()
// the thread is stopped and we can set the thread log buffer pointing to // the thread is stopped and we can set the thread log buffer pointing to
// the main log buffer (from the main thread) // the main log buffer (from the main thread)
item.object->set_log_buffer(log.GetLogBuffer()); item.object->set_log_buffer(log.get_log_buffer());
delete item.thread_item_data; delete item.thread_item_data;
item.thread_item_data = nullptr; item.thread_item_data = nullptr;

View File

@ -65,13 +65,13 @@ void WinixBase::set_synchro(Synchro * synchro)
void WinixBase::set_log_buffer(pt::WTextStream * log_buffer) void WinixBase::set_log_buffer(pt::WTextStream * log_buffer)
{ {
log.SetLogBuffer(log_buffer); log.set_log_buffer(log_buffer);
} }
void WinixBase::set_file_log(FileLog * file_log) void WinixBase::set_file_log(FileLog * file_log)
{ {
log.SetFileLog(file_log); log.set_file_log(file_log);
} }