Exemplo n.º 1
0
        public LogFile(string logFilePath, bool appendToFile, LogFileNamingType type)
        {
            if (string.IsNullOrEmpty(_LogFileName))
            {
                _LogFileName = "ServiceLog";
            }

            if (Directory.Exists(logFilePath) && LogFileName.Length > 0)
            {
                switch (type)
                {
                case LogFileNamingType.DateStamped:
                    if (logFilePath.EndsWith(@"\"))
                    {
                        logFilePath += LogFileName + DateStamp.GetDateStamp(false) + ".Log";
                    }
                    else
                    {
                        logFilePath += @"\" + LogFileName + DateStamp.GetDateStamp(false) + ".Log";
                    }
                    break;

                default:
                    if (logFilePath.EndsWith(@"\"))
                    {
                        logFilePath += LogFileName + DateStamp.GetDateStamp(false) + ".Log";
                    }
                    else
                    {
                        logFilePath += @"\" + LogFileName + DateStamp.GetDateStamp(false) + ".Log";
                    }
                    break;
                }
            }
            else
            {
                throw new Exception("FilePath or FileName is not valid!!!");
            }
            _logFilePath     = logFilePath;
            _appendToFile    = appendToFile;
            _logFileNameType = type;
        }
Exemplo n.º 2
0
 public LogFile(string logFilePath, bool appendToFile, LogFileNamingType type)
 {
     _logFilePath     = logFilePath;
     _appendToFile    = appendToFile;
     _logFileNameType = type;
 }