public XmlWriterTraceListener(string applicationName, string customLogPath = null, int historyDayCount = 2, bool isDelayedWrite = true, long maxFileSizeInByte = 0)
        {
            CustomLogPath        = customLogPath;
            IsDelayedWrite       = isDelayedWrite;
            HistoryDayCount      = historyDayCount;
            ApplicationName      = applicationName;
            _lastCreationLogDate = DateTime.MinValue;
            MaxFileSizeInByte    = maxFileSizeInByte;


            _logFileManager = new LogFileManager(ApplicationName, BaseRootPath, historyDayCount);

            _logFileManager.CreateNewLogFile(false);
            _lastCreationLogDate = DateTime.Today;

            if (!IsDelayedWrite)
            {
                _taskAppendLogsToDiskWithoutDelayed = Task.Factory.StartNew(token =>
                {
                    var cancellationToken = (CancellationToken)token;

                    while (true)
                    {
                        if (_lines.Count > 0)
                        {
                            WriteLogsToDisk();
                        }
                        else
                        {
                            if (cancellationToken.IsCancellationRequested)
                            {
                                break;
                            }

                            Thread.Sleep(WaitingBeforeWritingLogs);
                        }
                    }
                }, _cancellationToken.Token, _cancellationToken.Token /*, TaskCreationOptions.LongRunning, TaskScheduler.Default*/);
            }
            else
            {
                _timer = new Timer(OnTimerCallback, null, TimerSaveFrequency, TimerSaveFrequency);
            }
        }