2008-12-10 05:42:49 +01:00
|
|
|
/*
|
2010-02-28 01:08:10 +01:00
|
|
|
* This file is a part of Winix
|
2014-10-04 20:04:03 +02:00
|
|
|
* and is distributed under the 2-Clause BSD licence.
|
|
|
|
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2022-04-16 21:52:53 +02:00
|
|
|
* Copyright (c) 2008-2022, Tomasz Sowa
|
2008-12-10 05:42:49 +01:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
2014-10-04 20:04:03 +02:00
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are met:
|
|
|
|
*
|
|
|
|
* 1. Redistributions of source code must retain the above copyright notice,
|
|
|
|
* this list of conditions and the following disclaimer.
|
|
|
|
*
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
|
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
2008-12-10 05:42:49 +01:00
|
|
|
*/
|
|
|
|
|
2011-01-23 15:15:30 +01:00
|
|
|
#ifndef headerfile_winix_core_log
|
|
|
|
#define headerfile_winix_core_log
|
2008-12-10 05:42:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
#include <sstream>
|
|
|
|
#include <fstream>
|
|
|
|
#include <iostream>
|
|
|
|
#include <string>
|
2018-11-23 18:53:43 +01:00
|
|
|
|
2011-06-19 22:59:58 +02:00
|
|
|
#include "logmanipulators.h"
|
2018-11-21 12:03:53 +01:00
|
|
|
#include "filelog.h"
|
2018-11-23 18:53:43 +01:00
|
|
|
#include "log/log.h"
|
2021-06-24 21:17:03 +02:00
|
|
|
#include "morm.h"
|
|
|
|
|
2008-12-10 05:42:49 +01:00
|
|
|
|
|
|
|
|
2014-02-12 17:30:49 +01:00
|
|
|
namespace Winix
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-05-20 20:59:12 +02:00
|
|
|
class Log : public pt::Log
|
2008-12-10 05:42:49 +01:00
|
|
|
{
|
|
|
|
public:
|
2011-01-05 22:24:11 +01:00
|
|
|
|
2008-12-10 05:42:49 +01:00
|
|
|
Log();
|
2018-11-23 18:53:43 +01:00
|
|
|
virtual ~Log();
|
|
|
|
|
|
|
|
virtual void SetDependency(Log * log);
|
|
|
|
|
|
|
|
virtual void SetMaxRequests(int max_requests);
|
|
|
|
|
|
|
|
virtual Log & operator<<(const void * s);
|
|
|
|
virtual Log & operator<<(const char * s);
|
|
|
|
virtual Log & operator<<(const std::string * s);
|
|
|
|
virtual Log & operator<<(const std::string & s);
|
|
|
|
virtual Log & operator<<(const wchar_t * s);
|
|
|
|
virtual Log & operator<<(const std::wstring * s);
|
|
|
|
virtual Log & operator<<(const std::wstring & s);
|
|
|
|
virtual Log & operator<<(int s);
|
|
|
|
virtual Log & operator<<(long s);
|
|
|
|
virtual Log & operator<<(char s);
|
|
|
|
virtual Log & operator<<(wchar_t s);
|
|
|
|
virtual Log & operator<<(size_t s);
|
|
|
|
virtual Log & operator<<(double s);
|
2021-05-20 20:59:12 +02:00
|
|
|
virtual Log & operator<<(const pt::Space & space);
|
2018-11-23 18:53:43 +01:00
|
|
|
virtual Log & operator<<(LogManipulators m);
|
2022-04-16 21:52:53 +02:00
|
|
|
virtual Log & operator<<(pt::Log::Manipulators m);
|
2021-05-20 20:59:12 +02:00
|
|
|
virtual Log & operator<<(const pt::Date & date);
|
2021-04-30 01:34:48 +02:00
|
|
|
virtual Log & operator<<(morm::Model & model);
|
2018-11-23 18:53:43 +01:00
|
|
|
|
2021-05-20 20:59:12 +02:00
|
|
|
virtual void PrintDate(const pt::Date & date);
|
2012-09-06 19:50:14 +02:00
|
|
|
|
2012-07-25 12:28:41 +02:00
|
|
|
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
2021-05-20 20:59:12 +02:00
|
|
|
Log & operator<<(const pt::TextStreamBase<char_type, stack_size, heap_block_size> & buf);
|
2012-07-25 12:28:41 +02:00
|
|
|
|
2012-01-16 11:12:38 +01:00
|
|
|
|
2021-06-24 21:17:03 +02:00
|
|
|
/*
|
|
|
|
virtual Log & put_string(const std::string & value, size_t max_size);
|
|
|
|
virtual Log & put_string(const std::wstring & value, size_t max_size);
|
2010-10-24 19:49:38 +02:00
|
|
|
|
2021-06-24 21:17:03 +02:00
|
|
|
virtual Log & put_binary_blob(const char * blob, size_t blob_len);
|
|
|
|
virtual Log & put_binary_blob(const std::string & blob);
|
|
|
|
*/
|
2012-07-31 05:29:16 +02:00
|
|
|
|
2019-09-25 18:25:20 +02:00
|
|
|
//virtual Log & SystemErr(int err);
|
2012-07-31 05:29:16 +02:00
|
|
|
|
2011-01-05 22:24:11 +01:00
|
|
|
|
2018-11-21 12:03:53 +01:00
|
|
|
private:
|
2012-09-06 19:50:14 +02:00
|
|
|
|
2011-01-05 22:24:11 +01:00
|
|
|
// current request for logging
|
|
|
|
// starts from zero and incremented after logendrequest modifier
|
|
|
|
int request;
|
|
|
|
|
|
|
|
// how many request to save at once
|
|
|
|
int max_requests;
|
|
|
|
|
2008-12-10 05:42:49 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-06-07 00:47:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2012-07-25 12:28:41 +02:00
|
|
|
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
2021-05-20 20:59:12 +02:00
|
|
|
Log & Log::operator<<(const pt::TextStreamBase<char_type, stack_size, heap_block_size> & buf)
|
2012-07-25 12:28:41 +02:00
|
|
|
{
|
2021-05-20 20:59:12 +02:00
|
|
|
pt::Log::operator<<(buf);
|
2018-11-23 18:53:43 +01:00
|
|
|
return *this;
|
2012-07-25 12:28:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-02-12 17:30:49 +01:00
|
|
|
} // namespace Winix
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-12-10 05:42:49 +01:00
|
|
|
#endif
|
|
|
|
|