Index: ch.vc140.sln
===================================================================
diff -u -N -r4a481bbe77043e0bda2435c6d62a02700b3e46c5 -rcca174e74e108de1f5729e4cc6c46d2b9a5e25a7
--- ch.vc140.sln (.../ch.vc140.sln) (revision 4a481bbe77043e0bda2435c6d62a02700b3e46c5)
+++ ch.vc140.sln (.../ch.vc140.sln) (revision cca174e74e108de1f5729e4cc6c46d2b9a5e25a7)
@@ -32,6 +32,8 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gmock", "ext\googletest\gmock.vc140.vcxproj", "{D98F2D98-2352-4303-93EE-A5430C4E98AB}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblogger", "src\liblogger\liblogger.vc140.vcxproj", "{DF9957D4-3D95-4AC3-AD3F-DCBEA058F79D}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -156,6 +158,22 @@
{D98F2D98-2352-4303-93EE-A5430C4E98AB}.Testing Release|Win32.Build.0 = Testing Release|Win32
{D98F2D98-2352-4303-93EE-A5430C4E98AB}.Testing Release|x64.ActiveCfg = Testing Release|x64
{D98F2D98-2352-4303-93EE-A5430C4E98AB}.Testing Release|x64.Build.0 = Testing Release|x64
+ {DF9957D4-3D95-4AC3-AD3F-DCBEA058F79D}.Debug|Win32.ActiveCfg = Debug|Win32
+ {DF9957D4-3D95-4AC3-AD3F-DCBEA058F79D}.Debug|Win32.Build.0 = Debug|Win32
+ {DF9957D4-3D95-4AC3-AD3F-DCBEA058F79D}.Debug|x64.ActiveCfg = Debug|x64
+ {DF9957D4-3D95-4AC3-AD3F-DCBEA058F79D}.Debug|x64.Build.0 = Debug|x64
+ {DF9957D4-3D95-4AC3-AD3F-DCBEA058F79D}.Release|Win32.ActiveCfg = Release|Win32
+ {DF9957D4-3D95-4AC3-AD3F-DCBEA058F79D}.Release|Win32.Build.0 = Release|Win32
+ {DF9957D4-3D95-4AC3-AD3F-DCBEA058F79D}.Release|x64.ActiveCfg = Release|x64
+ {DF9957D4-3D95-4AC3-AD3F-DCBEA058F79D}.Release|x64.Build.0 = Release|x64
+ {DF9957D4-3D95-4AC3-AD3F-DCBEA058F79D}.Testing Debug|Win32.ActiveCfg = Testing Debug|Win32
+ {DF9957D4-3D95-4AC3-AD3F-DCBEA058F79D}.Testing Debug|Win32.Build.0 = Testing Debug|Win32
+ {DF9957D4-3D95-4AC3-AD3F-DCBEA058F79D}.Testing Debug|x64.ActiveCfg = Testing Debug|x64
+ {DF9957D4-3D95-4AC3-AD3F-DCBEA058F79D}.Testing Debug|x64.Build.0 = Testing Debug|x64
+ {DF9957D4-3D95-4AC3-AD3F-DCBEA058F79D}.Testing Release|Win32.ActiveCfg = Testing Release|Win32
+ {DF9957D4-3D95-4AC3-AD3F-DCBEA058F79D}.Testing Release|Win32.Build.0 = Testing Release|Win32
+ {DF9957D4-3D95-4AC3-AD3F-DCBEA058F79D}.Testing Release|x64.ActiveCfg = Testing Release|x64
+ {DF9957D4-3D95-4AC3-AD3F-DCBEA058F79D}.Testing Release|x64.Build.0 = Testing Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Index: src/ch/AsyncHttpFile.cpp
===================================================================
diff -u -N -r62d767936f1675e1db51174f53c91484fe691937 -rcca174e74e108de1f5729e4cc6c46d2b9a5e25a7
--- src/ch/AsyncHttpFile.cpp (.../AsyncHttpFile.cpp) (revision 62d767936f1675e1db51174f53c91484fe691937)
+++ src/ch/AsyncHttpFile.cpp (.../AsyncHttpFile.cpp) (revision cca174e74e108de1f5729e4cc6c46d2b9a5e25a7)
@@ -18,7 +18,7 @@
// ============================================================================
#include "stdafx.h"
#include "AsyncHttpFile.h"
-#include "../common/TLogger.h"
+#include "../liblogger/TLogger.h"
#include "ch.h"
// timeout used with waiting for events (avoiding hangs)
Index: src/ch/UpdaterDlg.cpp
===================================================================
diff -u -N -r62d767936f1675e1db51174f53c91484fe691937 -rcca174e74e108de1f5729e4cc6c46d2b9a5e25a7
--- src/ch/UpdaterDlg.cpp (.../UpdaterDlg.cpp) (revision 62d767936f1675e1db51174f53c91484fe691937)
+++ src/ch/UpdaterDlg.cpp (.../UpdaterDlg.cpp) (revision cca174e74e108de1f5729e4cc6c46d2b9a5e25a7)
@@ -12,7 +12,7 @@
#include "WindowsVersion.h"
#include "resource.h"
#include "CfgProperties.h"
-#include "../common/TLogger.h"
+#include "../liblogger/TLogger.h"
#define UPDATER_TIMER 639
Index: src/ch/ch.cpp
===================================================================
diff -u -N -rb8b97b70743c49fcc2aee0db4cb7118db5e26dab -rcca174e74e108de1f5729e4cc6c46d2b9a5e25a7
--- src/ch/ch.cpp (.../ch.cpp) (revision b8b97b70743c49fcc2aee0db4cb7118db5e26dab)
+++ src/ch/ch.cpp (.../ch.cpp) (revision cca174e74e108de1f5729e4cc6c46d2b9a5e25a7)
@@ -43,7 +43,7 @@
#include "TMsgBox.h"
#include "../libchcore/TWin32ErrorFormatter.h"
#include "resource.h"
-#include "../common/TLogger.h"
+#include "../liblogger/TLogger.h"
#ifdef _DEBUG
#define new DEBUG_NEW
Index: src/ch/ch.h
===================================================================
diff -u -N -rb8b97b70743c49fcc2aee0db4cb7118db5e26dab -rcca174e74e108de1f5729e4cc6c46d2b9a5e25a7
--- src/ch/ch.h (.../ch.h) (revision b8b97b70743c49fcc2aee0db4cb7118db5e26dab)
+++ src/ch/ch.h (.../ch.h) (revision cca174e74e108de1f5729e4cc6c46d2b9a5e25a7)
@@ -24,10 +24,10 @@
#include "../libchcore/TConfig.h"
#include "TShellExtensionClient.h"
#include "TCommandLineParser.h"
-#include "../common/TLogger.h"
-#include "../common/TLoggerInitializer.h"
+#include "../liblogger/TLogger.h"
+#include "../liblogger/TLoggerInitializer.h"
#include "../libchcore/TCoreEngine.h"
-#include "../common/TLoggerFactory.h"
+#include "../liblogger/TLoggerFactory.h"
class CCopyHandlerApp : public CWinApp, public CAppHelper
{
Index: src/ch/ch.vc140.vcxproj
===================================================================
diff -u -N -r62d767936f1675e1db51174f53c91484fe691937 -rcca174e74e108de1f5729e4cc6c46d2b9a5e25a7
--- src/ch/ch.vc140.vcxproj (.../ch.vc140.vcxproj) (revision 62d767936f1675e1db51174f53c91484fe691937)
+++ src/ch/ch.vc140.vcxproj (.../ch.vc140.vcxproj) (revision cca174e74e108de1f5729e4cc6c46d2b9a5e25a7)
@@ -510,16 +510,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -772,25 +762,6 @@
NotUsing
NotUsing
-
- 4512;4714
- 4512;4714
- 4512;4714
- 4512;4714
- 4512;4714
- 4512;4714
- 4512;4714
- 4512;4714
-
-
-
-
-
-
-
-
-
-
@@ -2011,6 +1982,9 @@
{dd1f3242-7ee4-4f41-8b8d-d833300c445f}
+
+ {df9957d4-3d95-4ac3-ad3f-dcbea058f79d}
+
Index: src/ch/ch.vc140.vcxproj.filters
===================================================================
diff -u -N -r62d767936f1675e1db51174f53c91484fe691937 -rcca174e74e108de1f5729e4cc6c46d2b9a5e25a7
--- src/ch/ch.vc140.vcxproj.filters (.../ch.vc140.vcxproj.filters) (revision 62d767936f1675e1db51174f53c91484fe691937)
+++ src/ch/ch.vc140.vcxproj.filters (.../ch.vc140.vcxproj.filters) (revision cca174e74e108de1f5729e4cc6c46d2b9a5e25a7)
@@ -63,9 +63,6 @@
{2e2638f2-07f6-4472-bd2d-32151a7ef9ce}
-
- {475febbf-e9ec-4293-a92f-d31c3f8c8072}
-
@@ -248,36 +245,6 @@
Source Files\Core
-
- Source Files\Shared\Logging
-
-
- Source Files\Shared\Logging
-
-
- Source Files\Shared\Logging
-
-
- Source Files\Shared\Logging
-
-
- Source Files\Shared\Logging
-
-
- Source Files\Shared\Logging
-
-
- Source Files\Shared\Logging
-
-
- Source Files\Shared\Logging
-
-
- Source Files\Shared\Logging
-
-
- Source Files\Shared\Logging
-
@@ -451,36 +418,6 @@
Source Files\Core
-
- Source Files\Shared\Logging
-
-
- Source Files\Shared\Logging
-
-
- Source Files\Shared\Logging
-
-
- Source Files\Shared\Logging
-
-
- Source Files\Shared\Logging
-
-
- Source Files\Shared\Logging
-
-
- Source Files\Shared\Logging
-
-
- Source Files\Shared\Logging
-
-
- Source Files\Shared\Logging
-
-
- Source Files\Shared\Logging
-
Index: src/libchcore/TCoreEngine.h
===================================================================
diff -u -N -rb8b97b70743c49fcc2aee0db4cb7118db5e26dab -rcca174e74e108de1f5729e4cc6c46d2b9a5e25a7
--- src/libchcore/TCoreEngine.h (.../TCoreEngine.h) (revision b8b97b70743c49fcc2aee0db4cb7118db5e26dab)
+++ src/libchcore/TCoreEngine.h (.../TCoreEngine.h) (revision cca174e74e108de1f5729e4cc6c46d2b9a5e25a7)
@@ -20,7 +20,7 @@
#define __TCOREENGINE_H__
#include "libchcore.h"
-#include "../common/TLoggerInitializer.h"
+#include "../liblogger/TLoggerInitializer.h"
namespace chcore
{
Index: src/libchcore/TFilesystemFeedbackWrapper.h
===================================================================
diff -u -N -r62d767936f1675e1db51174f53c91484fe691937 -rcca174e74e108de1f5729e4cc6c46d2b9a5e25a7
--- src/libchcore/TFilesystemFeedbackWrapper.h (.../TFilesystemFeedbackWrapper.h) (revision 62d767936f1675e1db51174f53c91484fe691937)
+++ src/libchcore/TFilesystemFeedbackWrapper.h (.../TFilesystemFeedbackWrapper.h) (revision cca174e74e108de1f5729e4cc6c46d2b9a5e25a7)
@@ -21,8 +21,8 @@
#include "IFilesystem.h"
#include "TSubTaskBase.h"
-#include "../common/TLogger.h"
-#include "../common/TLoggerFactory.h"
+#include "../liblogger/TLogger.h"
+#include "../liblogger/TLoggerFactory.h"
namespace chcore
{
Index: src/libchcore/TFilesystemFileFeedbackWrapper.h
===================================================================
diff -u -N -r62d767936f1675e1db51174f53c91484fe691937 -rcca174e74e108de1f5729e4cc6c46d2b9a5e25a7
--- src/libchcore/TFilesystemFileFeedbackWrapper.h (.../TFilesystemFileFeedbackWrapper.h) (revision 62d767936f1675e1db51174f53c91484fe691937)
+++ src/libchcore/TFilesystemFileFeedbackWrapper.h (.../TFilesystemFileFeedbackWrapper.h) (revision cca174e74e108de1f5729e4cc6c46d2b9a5e25a7)
@@ -23,8 +23,8 @@
#include "TSubTaskBase.h"
#include "IFeedbackHandler.h"
#include "IFilesystem.h"
-#include "../common/TLogger.h"
-#include "../common/TLoggerFactory.h"
+#include "../liblogger/TLogger.h"
+#include "../liblogger/TLoggerFactory.h"
namespace chcore
{
Index: src/libchcore/TPath.h
===================================================================
diff -u -N -rf866db90e4b058a4f2e13cc6cf076d1e0bf2d956 -rcca174e74e108de1f5729e4cc6c46d2b9a5e25a7
--- src/libchcore/TPath.h (.../TPath.h) (revision f866db90e4b058a4f2e13cc6cf076d1e0bf2d956)
+++ src/libchcore/TPath.h (.../TPath.h) (revision cca174e74e108de1f5729e4cc6c46d2b9a5e25a7)
@@ -30,7 +30,7 @@
class LIBCHCORE_API TSmartPath
{
protected:
- BOOST_STATIC_CONSTANT(bool, DefaultCaseSensitivity = false);
+ static const bool DefaultCaseSensitivity = false;
public:
// Construction/destruction
Index: src/libchcore/TStringArray.h
===================================================================
diff -u -N -rcb4e9d4b60d62b25ae2cf556c0642601af56c787 -rcca174e74e108de1f5729e4cc6c46d2b9a5e25a7
--- src/libchcore/TStringArray.h (.../TStringArray.h) (revision cb4e9d4b60d62b25ae2cf556c0642601af56c787)
+++ src/libchcore/TStringArray.h (.../TStringArray.h) (revision cca174e74e108de1f5729e4cc6c46d2b9a5e25a7)
@@ -25,6 +25,7 @@
#include "TString.h"
#include "libchcore.h"
+#include
namespace chcore
{
Index: src/libchcore/TSubTaskContext.h
===================================================================
diff -u -N -r62d767936f1675e1db51174f53c91484fe691937 -rcca174e74e108de1f5729e4cc6c46d2b9a5e25a7
--- src/libchcore/TSubTaskContext.h (.../TSubTaskContext.h) (revision 62d767936f1675e1db51174f53c91484fe691937)
+++ src/libchcore/TSubTaskContext.h (.../TSubTaskContext.h) (revision cca174e74e108de1f5729e4cc6c46d2b9a5e25a7)
@@ -29,7 +29,7 @@
#include "TBasePathData.h"
#include "TFileInfoArray.h"
#include "IFilesystem.h"
-#include "..\common\TLoggerFactory.h"
+#include "..\liblogger\TLoggerFactory.h"
namespace chcore
{
Index: src/libchcore/TSubTaskCopyMove.h
===================================================================
diff -u -N -r62d767936f1675e1db51174f53c91484fe691937 -rcca174e74e108de1f5729e4cc6c46d2b9a5e25a7
--- src/libchcore/TSubTaskCopyMove.h (.../TSubTaskCopyMove.h) (revision 62d767936f1675e1db51174f53c91484fe691937)
+++ src/libchcore/TSubTaskCopyMove.h (.../TSubTaskCopyMove.h) (revision cca174e74e108de1f5729e4cc6c46d2b9a5e25a7)
@@ -28,7 +28,7 @@
#include "CommonDataTypes.h"
#include "TBufferSizes.h"
#include "IFilesystemFile.h"
-#include "../common/TLogger.h"
+#include "../liblogger/TLogger.h"
namespace chcore
{
Index: src/libchcore/TSubTaskDelete.h
===================================================================
diff -u -N -r62d767936f1675e1db51174f53c91484fe691937 -rcca174e74e108de1f5729e4cc6c46d2b9a5e25a7
--- src/libchcore/TSubTaskDelete.h (.../TSubTaskDelete.h) (revision 62d767936f1675e1db51174f53c91484fe691937)
+++ src/libchcore/TSubTaskDelete.h (.../TSubTaskDelete.h) (revision cca174e74e108de1f5729e4cc6c46d2b9a5e25a7)
@@ -25,7 +25,7 @@
#include "libchcore.h"
#include "TSubTaskBase.h"
-#include "../common/TLogger.h"
+#include "../liblogger/TLogger.h"
namespace chcore
{
Index: src/libchcore/TSubTaskFastMove.h
===================================================================
diff -u -N -r62d767936f1675e1db51174f53c91484fe691937 -rcca174e74e108de1f5729e4cc6c46d2b9a5e25a7
--- src/libchcore/TSubTaskFastMove.h (.../TSubTaskFastMove.h) (revision 62d767936f1675e1db51174f53c91484fe691937)
+++ src/libchcore/TSubTaskFastMove.h (.../TSubTaskFastMove.h) (revision cca174e74e108de1f5729e4cc6c46d2b9a5e25a7)
@@ -25,7 +25,7 @@
#include "libchcore.h"
#include "TSubTaskBase.h"
-#include "../Common/TLogger.h"
+#include "../liblogger/TLogger.h"
namespace chcore
{
Index: src/libchcore/TSubTaskScanDirectory.h
===================================================================
diff -u -N -r62d767936f1675e1db51174f53c91484fe691937 -rcca174e74e108de1f5729e4cc6c46d2b9a5e25a7
--- src/libchcore/TSubTaskScanDirectory.h (.../TSubTaskScanDirectory.h) (revision 62d767936f1675e1db51174f53c91484fe691937)
+++ src/libchcore/TSubTaskScanDirectory.h (.../TSubTaskScanDirectory.h) (revision cca174e74e108de1f5729e4cc6c46d2b9a5e25a7)
@@ -27,7 +27,7 @@
#include "TSubTaskBase.h"
#include "TPath.h"
#include "TBasePathData.h"
-#include "../common/TLogger.h"
+#include "../liblogger/TLogger.h"
namespace chcore
{
Index: src/libchcore/TTask.h
===================================================================
diff -u -N -r62d767936f1675e1db51174f53c91484fe691937 -rcca174e74e108de1f5729e4cc6c46d2b9a5e25a7
--- src/libchcore/TTask.h (.../TTask.h) (revision 62d767936f1675e1db51174f53c91484fe691937)
+++ src/libchcore/TTask.h (.../TTask.h) (revision cca174e74e108de1f5729e4cc6c46d2b9a5e25a7)
@@ -34,8 +34,8 @@
#include "TTaskBaseData.h"
#include
#include "IFilesystem.h"
-#include "..\Common\TLogger.h"
-#include "..\common\TLoggerFactory.h"
+#include "..\liblogger\TLogger.h"
+#include "..\liblogger\TLoggerFactory.h"
namespace chcore
{
Index: src/libchcore/TTaskConfigVerifier.cpp
===================================================================
diff -u -N -r62d767936f1675e1db51174f53c91484fe691937 -rcca174e74e108de1f5729e4cc6c46d2b9a5e25a7
--- src/libchcore/TTaskConfigVerifier.cpp (.../TTaskConfigVerifier.cpp) (revision 62d767936f1675e1db51174f53c91484fe691937)
+++ src/libchcore/TTaskConfigVerifier.cpp (.../TTaskConfigVerifier.cpp) (revision cca174e74e108de1f5729e4cc6c46d2b9a5e25a7)
@@ -20,7 +20,7 @@
#include "TTaskConfigVerifier.h"
#include "TTaskConfiguration.h"
#include
-#include "..\Common\TLogger.h"
+#include "..\liblogger\TLogger.h"
namespace chcore
{
Index: src/libchcore/TTaskConfigVerifier.h
===================================================================
diff -u -N -r62d767936f1675e1db51174f53c91484fe691937 -rcca174e74e108de1f5729e4cc6c46d2b9a5e25a7
--- src/libchcore/TTaskConfigVerifier.h (.../TTaskConfigVerifier.h) (revision 62d767936f1675e1db51174f53c91484fe691937)
+++ src/libchcore/TTaskConfigVerifier.h (.../TTaskConfigVerifier.h) (revision cca174e74e108de1f5729e4cc6c46d2b9a5e25a7)
@@ -19,7 +19,7 @@
#ifndef __TTASKCONFIGVERIFIER_H__
#define __TTASKCONFIGVERIFIER_H__
-#include "..\common\TLogger.h"
+#include "..\liblogger\TLogger.h"
namespace chcore
{
Index: src/libchcore/TTaskManager.h
===================================================================
diff -u -N -r62d767936f1675e1db51174f53c91484fe691937 -rcca174e74e108de1f5729e4cc6c46d2b9a5e25a7
--- src/libchcore/TTaskManager.h (.../TTaskManager.h) (revision 62d767936f1675e1db51174f53c91484fe691937)
+++ src/libchcore/TTaskManager.h (.../TTaskManager.h) (revision cca174e74e108de1f5729e4cc6c46d2b9a5e25a7)
@@ -27,7 +27,7 @@
#include "ISerializer.h"
#include "ISerializerFactory.h"
#include "TObsoleteFiles.h"
-#include "..\common\TMultiLoggerConfig.h"
+#include "..\liblogger\TMultiLoggerConfig.h"
namespace chcore
{
Index: src/libchcore/libchcore.vc140.vcxproj
===================================================================
diff -u -N -r62d767936f1675e1db51174f53c91484fe691937 -rcca174e74e108de1f5729e4cc6c46d2b9a5e25a7
--- src/libchcore/libchcore.vc140.vcxproj (.../libchcore.vc140.vcxproj) (revision 62d767936f1675e1db51174f53c91484fe691937)
+++ src/libchcore/libchcore.vc140.vcxproj (.../libchcore.vc140.vcxproj) (revision cca174e74e108de1f5729e4cc6c46d2b9a5e25a7)
@@ -455,16 +455,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -606,16 +596,6 @@
NotUsing
NotUsing
-
-
-
-
-
-
-
-
-
-
@@ -876,6 +856,9 @@
{d41831f5-b2a5-4c92-9f15-1d9ab04722cc}
+
+ {df9957d4-3d95-4ac3-ad3f-dcbea058f79d}
+
Index: src/libchcore/libchcore.vc140.vcxproj.filters
===================================================================
diff -u -N -r62d767936f1675e1db51174f53c91484fe691937 -rcca174e74e108de1f5729e4cc6c46d2b9a5e25a7
--- src/libchcore/libchcore.vc140.vcxproj.filters (.../libchcore.vc140.vcxproj.filters) (revision 62d767936f1675e1db51174f53c91484fe691937)
+++ src/libchcore/libchcore.vc140.vcxproj.filters (.../libchcore.vc140.vcxproj.filters) (revision cca174e74e108de1f5729e4cc6c46d2b9a5e25a7)
@@ -84,9 +84,6 @@
{0bd6a559-b992-4f1d-abe6-f8105a9d5f50}
-
- {4a321c2c-525d-4a77-bad6-d01210bba74c}
-
@@ -461,39 +458,9 @@
Source Files\Task Config
-
- Source Files\Shared\Logging
-
-
- Source Files\Shared\Logging
-
Source Files\Library files
-
- Source Files\Shared\Logging
-
-
- Source Files\Shared\Logging
-
-
- Source Files\Shared\Logging
-
-
- Source Files\Shared\Logging
-
-
- Source Files\Shared\Logging
-
-
- Source Files\Shared\Logging
-
-
- Source Files\Shared\Logging
-
-
- Source Files\Shared\Logging
-
@@ -874,38 +841,8 @@
Tests\TaskConfig
-
- Source Files\Shared\Logging
-
-
- Source Files\Shared\Logging
-
-
- Source Files\Shared\Logging
-
-
- Source Files\Shared\Logging
-
-
- Source Files\Shared\Logging
-
-
- Source Files\Shared\Logging
-
Source Files\Library files
-
- Source Files\Shared\Logging
-
-
- Source Files\Shared\Logging
-
-
- Source Files\Shared\Logging
-
-
- Source Files\Shared\Logging
-
\ No newline at end of file
Index: src/liblogger/TLogRotator.cpp
===================================================================
diff -u -N
--- src/liblogger/TLogRotator.cpp (revision 0)
+++ src/liblogger/TLogRotator.cpp (revision cca174e74e108de1f5729e4cc6c46d2b9a5e25a7)
@@ -0,0 +1,97 @@
+// ============================================================================
+// Copyright (C) 2001-2016 by Jozef Starosczyk
+// ixen@copyhandler.com
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU Library General Public License
+// (version 2) as published by the Free Software Foundation;
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+// ============================================================================
+#include "stdafx.h"
+#include "TLogRotator.h"
+#include
+#include
+#include "..\libchcore\TString.h"
+#include "TLogSinkCollection.h"
+#include "..\libchcore\TFileException.h"
+#include
+
+namespace chcore
+{
+ TLogRotator::TLogRotator(unsigned int uiMaxRotatedFiles, unsigned long long ullMaxLogSize) :
+ m_uiMaxRotatedFiles(uiMaxRotatedFiles),
+ m_ullMaxLogSize(ullMaxLogSize)
+ {
+ }
+
+ void TLogRotator::SetLimits(unsigned int uiMaxRotatedFiles, unsigned long long ullMaxLogSize)
+ {
+ m_uiMaxRotatedFiles = uiMaxRotatedFiles;
+ m_ullMaxLogSize = ullMaxLogSize;
+ }
+
+ void TLogRotator::RotateFile(const TSmartPath& pathLog, TLogSink& sinkData, size_t stRequiredSpace)
+ {
+ unsigned long long ullCurrentLogSize = sinkData.GetCurrentLogSize();
+ unsigned long long ullNewSize = ullCurrentLogSize + stRequiredSpace;
+ if (ullCurrentLogSize == 0 || ullNewSize < m_ullMaxLogSize)
+ return;
+
+ sinkData.CloseLogFile();
+
+ TString pathNew = pathLog.ToWString();
+ if (pathNew.EndsWithNoCase(L".log"))
+ pathNew.LeftSelf(pathNew.GetLength() - 4);
+
+ boost::posix_time::ptime timeNow = boost::posix_time::second_clock::local_time();
+ boost::posix_time::time_facet* facet = new boost::posix_time::time_facet();
+ facet->format("%Y%m%d%H%M%S");
+ std::wstringstream stream;
+ stream.imbue(std::locale(std::locale::classic(), facet));
+ stream << time;
+ pathNew.Append(L".");
+ pathNew.Append(stream.str().c_str());
+ pathNew.Append(L".log");
+
+ if (!MoveFile(pathLog.ToString(), pathNew.c_str()))
+ throw TFileException(eErr_CannotFastMove, GetLastError(), pathLog, L"Cannot rotate file", LOCATION);
+
+ sinkData.AddRotatedFile(PathFromWString(pathNew));
+ sinkData.RemoveObsoleteRotatedLogs(m_uiMaxRotatedFiles);
+ }
+
+ void TLogRotator::ScanForLogs(const TSmartPath& pathDir, TLogSinkCollection& rCollection)
+ {
+ TSmartPath pathSearch = pathDir;
+ pathSearch += PathFromString(L"*.log");
+
+ std::vector vPaths;
+ WIN32_FIND_DATA wfd = { 0 };
+
+ HANDLE hFind = FindFirstFile(pathSearch.ToString(), &wfd);
+ BOOL bFound = (hFind != INVALID_HANDLE_VALUE);
+ while (bFound)
+ {
+ TSmartPath pathFound = pathDir + PathFromString(wfd.cFileName);
+ vPaths.push_back(pathFound);
+
+ bFound = FindNextFile(hFind, &wfd);
+ }
+
+ std::sort(vPaths.begin(), vPaths.end(), [](const TSmartPath& path1, const TSmartPath& path2) { return path2 > path1; });
+
+ for (const TSmartPath& rPath : vPaths)
+ {
+ rCollection.AddPath(rPath);
+ }
+ }
+}
Index: src/common/TLogRotator.cpp
===================================================================
diff -u -N
--- src/common/TLogRotator.cpp (revision 62d767936f1675e1db51174f53c91484fe691937)
+++ src/common/TLogRotator.cpp (revision 0)
@@ -1,96 +0,0 @@
-// ============================================================================
-// Copyright (C) 2001-2016 by Jozef Starosczyk
-// ixen@copyhandler.com
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU Library General Public License
-// (version 2) as published by the Free Software Foundation;
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this program; if not, write to the
-// Free Software Foundation, Inc.,
-// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-// ============================================================================
-#include "stdafx.h"
-#include "TLogRotator.h"
-#include
-#include
-#include "..\libchcore\TString.h"
-#include "TLogSinkCollection.h"
-#include "..\libchcore\TFileException.h"
-
-namespace chcore
-{
- TLogRotator::TLogRotator(unsigned int uiMaxRotatedFiles, unsigned long long ullMaxLogSize) :
- m_uiMaxRotatedFiles(uiMaxRotatedFiles),
- m_ullMaxLogSize(ullMaxLogSize)
- {
- }
-
- void TLogRotator::SetLimits(unsigned int uiMaxRotatedFiles, unsigned long long ullMaxLogSize)
- {
- m_uiMaxRotatedFiles = uiMaxRotatedFiles;
- m_ullMaxLogSize = ullMaxLogSize;
- }
-
- void TLogRotator::RotateFile(const TSmartPath& pathLog, TLogSink& sinkData, size_t stRequiredSpace)
- {
- unsigned long long ullCurrentLogSize = sinkData.GetCurrentLogSize();
- unsigned long long ullNewSize = ullCurrentLogSize + stRequiredSpace;
- if (ullCurrentLogSize == 0 || ullNewSize < m_ullMaxLogSize)
- return;
-
- sinkData.CloseLogFile();
-
- TString pathNew = pathLog.ToWString();
- if (pathNew.EndsWithNoCase(L".log"))
- pathNew.LeftSelf(pathNew.GetLength() - 4);
-
- boost::posix_time::ptime timeNow = boost::posix_time::second_clock::local_time();
- boost::posix_time::time_facet* facet = new boost::posix_time::time_facet();
- facet->format("%Y%m%d%H%M%S");
- std::wstringstream stream;
- stream.imbue(std::locale(std::locale::classic(), facet));
- stream << time;
- pathNew.Append(L".");
- pathNew.Append(stream.str().c_str());
- pathNew.Append(L".log");
-
- if (!MoveFile(pathLog.ToString(), pathNew.c_str()))
- throw TFileException(eErr_CannotFastMove, GetLastError(), pathLog, L"Cannot rotate file", LOCATION);
-
- sinkData.AddRotatedFile(PathFromWString(pathNew));
- sinkData.RemoveObsoleteRotatedLogs(m_uiMaxRotatedFiles);
- }
-
- void TLogRotator::ScanForLogs(const TSmartPath& pathDir, TLogSinkCollection& rCollection)
- {
- TSmartPath pathSearch = pathDir;
- pathSearch += PathFromString(L"*.log");
-
- std::vector vPaths;
- WIN32_FIND_DATA wfd = { 0 };
-
- HANDLE hFind = FindFirstFile(pathSearch.ToString(), &wfd);
- BOOL bFound = (hFind != INVALID_HANDLE_VALUE);
- while (bFound)
- {
- TSmartPath pathFound = pathDir + PathFromString(wfd.cFileName);
- vPaths.push_back(pathFound);
-
- bFound = FindNextFile(hFind, &wfd);
- }
-
- std::sort(vPaths.begin(), vPaths.end(), [](const TSmartPath& path1, const TSmartPath& path2) { return path2 > path1; });
-
- for (const TSmartPath& rPath : vPaths)
- {
- rCollection.AddPath(rPath);
- }
- }
-}
Index: src/liblogger/TLogRotator.h
===================================================================
diff -u -N
--- src/liblogger/TLogRotator.h (revision 0)
+++ src/liblogger/TLogRotator.h (revision cca174e74e108de1f5729e4cc6c46d2b9a5e25a7)
@@ -0,0 +1,45 @@
+// ============================================================================
+// Copyright (C) 2001-2016 by Jozef Starosczyk
+// ixen@copyhandler.com
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU Library General Public License
+// (version 2) as published by the Free Software Foundation;
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+// ============================================================================
+#ifndef __TLOGROTATOR_H__
+#define __TLOGROTATOR_H__
+
+#include "..\libchcore\TPath.h"
+#include "TLogSink.h"
+
+namespace chcore
+{
+ class TLogSinkCollection;
+
+ class TLogRotator
+ {
+ public:
+ TLogRotator(unsigned int uiMaxRotatedFiles, unsigned long long ullMaxLogSize);
+
+ void SetLimits(unsigned int uiMaxRotatedFiles, unsigned long long ullMaxLogSize);
+
+ void RotateFile(const TSmartPath& pathLog, TLogSink& sinkData, size_t stRequiredSpace);
+ static void ScanForLogs(const TSmartPath& pathDir, TLogSinkCollection& rCollection);
+
+ private:
+ unsigned int m_uiMaxRotatedFiles = 0;
+ unsigned long long m_ullMaxLogSize = 0;
+ };
+}
+
+#endif
Index: src/common/TLogRotator.h
===================================================================
diff -u -N
--- src/common/TLogRotator.h (revision 62d767936f1675e1db51174f53c91484fe691937)
+++ src/common/TLogRotator.h (revision 0)
@@ -1,45 +0,0 @@
-// ============================================================================
-// Copyright (C) 2001-2016 by Jozef Starosczyk
-// ixen@copyhandler.com
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU Library General Public License
-// (version 2) as published by the Free Software Foundation;
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this program; if not, write to the
-// Free Software Foundation, Inc.,
-// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-// ============================================================================
-#ifndef __TLOGROTATOR_H__
-#define __TLOGROTATOR_H__
-
-#include "..\libchcore\TPath.h"
-#include "TLogSink.h"
-
-namespace chcore
-{
- class TLogSinkCollection;
-
- class TLogRotator
- {
- public:
- TLogRotator(unsigned int uiMaxRotatedFiles, unsigned long long ullMaxLogSize);
-
- void SetLimits(unsigned int uiMaxRotatedFiles, unsigned long long ullMaxLogSize);
-
- void RotateFile(const TSmartPath& pathLog, TLogSink& sinkData, size_t stRequiredSpace);
- static void ScanForLogs(const TSmartPath& pathDir, TLogSinkCollection& rCollection);
-
- private:
- unsigned int m_uiMaxRotatedFiles = 0;
- unsigned long long m_ullMaxLogSize = 0;
- };
-}
-
-#endif
Index: src/liblogger/TLogSink.cpp
===================================================================
diff -u -N
--- src/liblogger/TLogSink.cpp (revision 0)
+++ src/liblogger/TLogSink.cpp (revision cca174e74e108de1f5729e4cc6c46d2b9a5e25a7)
@@ -0,0 +1,84 @@
+// ============================================================================
+// Copyright (C) 2001-2016 by Jozef Starosczyk
+// ixen@copyhandler.com
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU Library General Public License
+// (version 2) as published by the Free Software Foundation;
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+// ============================================================================
+#include "stdafx.h"
+#include "TLogSink.h"
+#include "..\libchcore\TFileException.h"
+
+namespace chcore
+{
+ TLogSink::TLogSink(const chcore::TSmartPath& pathLog)
+ : m_pathLog(pathLog)
+ {
+ }
+
+ HANDLE TLogSink::GetFileHandle()
+ {
+ if (m_handleFile != INVALID_HANDLE_VALUE)
+ return m_handleFile;
+
+ m_handleFile = CreateFile(m_pathLog.ToString(), GENERIC_WRITE, FILE_SHARE_READ, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
+ if (m_handleFile == INVALID_HANDLE_VALUE)
+ throw TFileException(eErr_CannotOpenFile, GetLastError(), m_pathLog, L"Cannot open log file", LOCATION);
+
+ LARGE_INTEGER liSeek = { 0 };
+
+ BOOL bRes = SetFilePointerEx(m_handleFile, liSeek, nullptr, SEEK_END);
+ if (!bRes)
+ throw TFileException(eErr_CannotOpenFile, GetLastError(), m_pathLog, L"Cannot seek to the end of log file", LOCATION);
+
+ return m_handleFile;
+ }
+
+ unsigned long long TLogSink::GetCurrentLogSize()
+ {
+ LARGE_INTEGER liSize = { 0 };
+ if (!GetFileSizeEx(GetFileHandle(), &liSize))
+ throw new TFileException(eErr_CannotGetFileInfo, GetLastError(), m_pathLog, L"Cannot determine current log size", LOCATION);
+
+ return liSize.QuadPart;
+ }
+
+ void TLogSink::AddRotatedFile(const TSmartPath& rPath)
+ {
+ m_setRotatedFiles.insert(rPath);
+ }
+
+ void TLogSink::RemoveObsoleteRotatedLogs(unsigned int uiMaxRotatedFiles)
+ {
+ while (m_setRotatedFiles.size() > uiMaxRotatedFiles)
+ {
+ auto iterRotatedFile = m_setRotatedFiles.begin();
+ if (!DeleteFile(iterRotatedFile->ToString()))
+ break;
+
+ m_setRotatedFiles.erase(iterRotatedFile);
+ }
+ }
+
+ void chcore::TLogSink::CloseLogFile()
+ {
+ m_handleFile.Close();
+ }
+
+ void chcore::TLogSink::CloseIfTimedOut(unsigned long long ullCurrentTimestamp, unsigned long long ullMaxHandleCacheTime)
+ {
+ if (ullCurrentTimestamp - m_ullLastUsageTimestamp > ullMaxHandleCacheTime)
+ CloseLogFile();
+ }
+}
Index: src/common/TLogSink.cpp
===================================================================
diff -u -N
--- src/common/TLogSink.cpp (revision b8b97b70743c49fcc2aee0db4cb7118db5e26dab)
+++ src/common/TLogSink.cpp (revision 0)
@@ -1,84 +0,0 @@
-// ============================================================================
-// Copyright (C) 2001-2016 by Jozef Starosczyk
-// ixen@copyhandler.com
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU Library General Public License
-// (version 2) as published by the Free Software Foundation;
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this program; if not, write to the
-// Free Software Foundation, Inc.,
-// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-// ============================================================================
-#include "stdafx.h"
-#include "TLogSink.h"
-#include "..\libchcore\TFileException.h"
-
-namespace chcore
-{
- TLogSink::TLogSink(const chcore::TSmartPath& pathLog)
- : m_pathLog(pathLog)
- {
- }
-
- HANDLE TLogSink::GetFileHandle()
- {
- if (m_handleFile != INVALID_HANDLE_VALUE)
- return m_handleFile;
-
- m_handleFile = CreateFile(m_pathLog.ToString(), GENERIC_WRITE, FILE_SHARE_READ, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
- if (m_handleFile == INVALID_HANDLE_VALUE)
- throw TFileException(eErr_CannotOpenFile, GetLastError(), m_pathLog, L"Cannot open log file", LOCATION);
-
- LARGE_INTEGER liSeek = { 0 };
-
- BOOL bRes = SetFilePointerEx(m_handleFile, liSeek, nullptr, SEEK_END);
- if (!bRes)
- throw TFileException(eErr_CannotOpenFile, GetLastError(), m_pathLog, L"Cannot seek to the end of log file", LOCATION);
-
- return m_handleFile;
- }
-
- unsigned long long TLogSink::GetCurrentLogSize()
- {
- LARGE_INTEGER liSize = { 0 };
- if (!GetFileSizeEx(GetFileHandle(), &liSize))
- throw new TFileException(eErr_CannotGetFileInfo, GetLastError(), m_pathLog, L"Cannot determine current log size", LOCATION);
-
- return liSize.QuadPart;
- }
-
- void TLogSink::AddRotatedFile(const TSmartPath& rPath)
- {
- m_setRotatedFiles.insert(rPath);
- }
-
- void TLogSink::RemoveObsoleteRotatedLogs(unsigned int uiMaxRotatedFiles)
- {
- while (m_setRotatedFiles.size() > uiMaxRotatedFiles)
- {
- auto iterRotatedFile = m_setRotatedFiles.begin();
- if (!DeleteFile(iterRotatedFile->ToString()))
- break;
-
- m_setRotatedFiles.erase(iterRotatedFile);
- }
- }
-
- void chcore::TLogSink::CloseLogFile()
- {
- m_handleFile.Close();
- }
-
- void chcore::TLogSink::CloseIfTimedOut(unsigned long long ullCurrentTimestamp, unsigned long long ullMaxHandleCacheTime)
- {
- if (ullCurrentTimestamp - m_ullLastUsageTimestamp > ullMaxHandleCacheTime)
- CloseLogFile();
- }
-}
Index: src/liblogger/TLogSink.h
===================================================================
diff -u -N
--- src/liblogger/TLogSink.h (revision 0)
+++ src/liblogger/TLogSink.h (revision cca174e74e108de1f5729e4cc6c46d2b9a5e25a7)
@@ -0,0 +1,50 @@
+// ============================================================================
+// Copyright (C) 2001-2016 by Jozef Starosczyk
+// ixen@copyhandler.com
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU Library General Public License
+// (version 2) as published by the Free Software Foundation;
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+// ============================================================================
+#ifndef __TLOGSINK_H__
+#define __TLOGSINK_H__
+
+#include "..\libchcore\TPath.h"
+#include "..\libchcore\TAutoHandles.h"
+#include
+
+namespace chcore
+{
+ class TLogSink
+ {
+ public:
+ TLogSink(const chcore::TSmartPath& pathLog);
+
+ HANDLE GetFileHandle();
+ unsigned long long GetCurrentLogSize();
+
+ void CloseLogFile();
+ void CloseIfTimedOut(unsigned long long ullCurrentTimestamp, unsigned long long ullMaxHandleCacheTime);
+
+ void AddRotatedFile(const TSmartPath& rPath);
+ void RemoveObsoleteRotatedLogs(unsigned int uiMaxRotatedFiles);
+
+ private:
+ chcore::TSmartPath m_pathLog;
+ chcore::TAutoFileHandle m_handleFile;
+ unsigned long long m_ullLastUsageTimestamp = 0;
+ std::set m_setRotatedFiles;
+ };
+}
+
+#endif
Index: src/common/TLogSink.h
===================================================================
diff -u -N
--- src/common/TLogSink.h (revision 62d767936f1675e1db51174f53c91484fe691937)
+++ src/common/TLogSink.h (revision 0)
@@ -1,50 +0,0 @@
-// ============================================================================
-// Copyright (C) 2001-2016 by Jozef Starosczyk
-// ixen@copyhandler.com
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU Library General Public License
-// (version 2) as published by the Free Software Foundation;
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this program; if not, write to the
-// Free Software Foundation, Inc.,
-// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-// ============================================================================
-#ifndef __TLOGSINK_H__
-#define __TLOGSINK_H__
-
-#include "..\libchcore\TPath.h"
-#include "..\libchcore\TAutoHandles.h"
-#include
-
-namespace chcore
-{
- class TLogSink
- {
- public:
- TLogSink(const chcore::TSmartPath& pathLog);
-
- HANDLE GetFileHandle();
- unsigned long long GetCurrentLogSize();
-
- void CloseLogFile();
- void CloseIfTimedOut(unsigned long long ullCurrentTimestamp, unsigned long long ullMaxHandleCacheTime);
-
- void AddRotatedFile(const TSmartPath& rPath);
- void RemoveObsoleteRotatedLogs(unsigned int uiMaxRotatedFiles);
-
- private:
- chcore::TSmartPath m_pathLog;
- chcore::TAutoFileHandle m_handleFile;
- unsigned long long m_ullLastUsageTimestamp = 0;
- std::set m_setRotatedFiles;
- };
-}
-
-#endif
Index: src/liblogger/TLogSinkCollection.cpp
===================================================================
diff -u -N
--- src/liblogger/TLogSinkCollection.cpp (revision 0)
+++ src/liblogger/TLogSinkCollection.cpp (revision cca174e74e108de1f5729e4cc6c46d2b9a5e25a7)
@@ -0,0 +1,81 @@
+// ============================================================================
+// Copyright (C) 2001-2016 by Jozef Starosczyk
+// ixen@copyhandler.com
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU Library General Public License
+// (version 2) as published by the Free Software Foundation;
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+// ============================================================================
+#include "stdafx.h"
+#include "TLogSinkCollection.h"
+#include "..\libchcore\TStringArray.h"
+#include
+
+namespace chcore
+{
+ TLogSinkCollection::TLogSinkCollection()
+ {
+
+ }
+
+ void TLogSinkCollection::AddPath(const TSmartPath& rPath)
+ {
+ TStringArray arrComponents;
+ TSmartPath pathToFileWithoutExtension = rPath.GetFileTitle();
+ pathToFileWithoutExtension.ToWString().Split(L".", arrComponents);
+
+ switch (arrComponents.GetCount())
+ {
+ case 0:
+ break;
+ case 1:
+ {
+ GetSinkData(rPath);
+ break;
+ }
+ default:
+ {
+ TSmartPath pathBase = rPath.GetFileDir() + pathToFileWithoutExtension.GetFileTitle();
+ TLogSink& rSinkData = GetSinkData(pathBase);
+
+ std::wstring strRotateInfo = arrComponents.GetAt(arrComponents.GetCount() - 1).c_str();
+ if (std::all_of(strRotateInfo.begin(), strRotateInfo.end(), isdigit))
+ {
+ rSinkData.AddRotatedFile(rPath);
+ }
+ }
+ }
+ }
+
+ TLogSink& TLogSinkCollection::GetSinkData(const TSmartPath& path)
+ {
+ auto iterFind = m_mapLogs.find(path);
+ if (iterFind == m_mapLogs.end())
+ iterFind = m_mapLogs.insert(std::make_pair(path, TLogSink(path))).first;
+
+ return iterFind->second;
+ }
+
+ void TLogSinkCollection::Clear()
+ {
+ m_mapLogs.clear();
+ }
+
+ void TLogSinkCollection::CloseExpiredFiles(unsigned long long ullCurrentTimestamp, unsigned long long ullMaxHandleCacheTime)
+ {
+ for (auto& pairSink : m_mapLogs)
+ {
+ pairSink.second.CloseIfTimedOut(ullCurrentTimestamp, ullMaxHandleCacheTime);
+ }
+ }
+}
Index: src/common/TLogSinkCollection.cpp
===================================================================
diff -u -N
--- src/common/TLogSinkCollection.cpp (revision 62d767936f1675e1db51174f53c91484fe691937)
+++ src/common/TLogSinkCollection.cpp (revision 0)
@@ -1,80 +0,0 @@
-// ============================================================================
-// Copyright (C) 2001-2016 by Jozef Starosczyk
-// ixen@copyhandler.com
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU Library General Public License
-// (version 2) as published by the Free Software Foundation;
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this program; if not, write to the
-// Free Software Foundation, Inc.,
-// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-// ============================================================================
-#include "stdafx.h"
-#include "TLogSinkCollection.h"
-#include "..\libchcore\TStringArray.h"
-
-namespace chcore
-{
- TLogSinkCollection::TLogSinkCollection()
- {
-
- }
-
- void TLogSinkCollection::AddPath(const TSmartPath& rPath)
- {
- TStringArray arrComponents;
- TSmartPath pathToFileWithoutExtension = rPath.GetFileTitle();
- pathToFileWithoutExtension.ToWString().Split(L".", arrComponents);
-
- switch (arrComponents.GetCount())
- {
- case 0:
- break;
- case 1:
- {
- GetSinkData(rPath);
- break;
- }
- default:
- {
- TSmartPath pathBase = rPath.GetFileDir() + pathToFileWithoutExtension.GetFileTitle();
- TLogSink& rSinkData = GetSinkData(pathBase);
-
- std::wstring strRotateInfo = arrComponents.GetAt(arrComponents.GetCount() - 1).c_str();
- if (std::all_of(strRotateInfo.begin(), strRotateInfo.end(), isdigit))
- {
- rSinkData.AddRotatedFile(rPath);
- }
- }
- }
- }
-
- TLogSink& TLogSinkCollection::GetSinkData(const TSmartPath& path)
- {
- auto iterFind = m_mapLogs.find(path);
- if (iterFind == m_mapLogs.end())
- iterFind = m_mapLogs.insert(std::make_pair(path, TLogSink(path))).first;
-
- return iterFind->second;
- }
-
- void TLogSinkCollection::Clear()
- {
- m_mapLogs.clear();
- }
-
- void TLogSinkCollection::CloseExpiredFiles(unsigned long long ullCurrentTimestamp, unsigned long long ullMaxHandleCacheTime)
- {
- for (auto& pairSink : m_mapLogs)
- {
- pairSink.second.CloseIfTimedOut(ullCurrentTimestamp, ullMaxHandleCacheTime);
- }
- }
-}
Index: src/liblogger/TLogSinkCollection.h
===================================================================
diff -u -N
--- src/liblogger/TLogSinkCollection.h (revision 0)
+++ src/liblogger/TLogSinkCollection.h (revision cca174e74e108de1f5729e4cc6c46d2b9a5e25a7)
@@ -0,0 +1,45 @@
+// ============================================================================
+// Copyright (C) 2001-2016 by Jozef Starosczyk
+// ixen@copyhandler.com
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU Library General Public License
+// (version 2) as published by the Free Software Foundation;
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+// ============================================================================
+#ifndef __TLOGSINKCOLLECTION_H__
+#define __TLOGSINKCOLLECTION_H__
+
+#include