예제 #1
0
        static void Main(string[] args)
        {
            #region Initialization

            var config = new nk.logger.csv.LoggerConfig()
                         .SetReplacementValue(';')
                         .SetRelativePath("logs");
            var logger = new nk.logger.csv.Logger(config);

            #endregion Initialization

            #region Logging

            // inner exception should be logged
            var exception = new ArgumentNullException("arg-1", new Exception("args-2"));
            logger.Error(exception);

            // comma should not be logged
            logger.Info("sample info text,");

            // should not be logged
            logger.Error("");

            // should not be logged
            logger.Fatal(ex: null);

            #endregion Logging

            Console.WriteLine("Completed Test");
            Console.WriteLine("Check if the Excel file is created");
        }
 public void Setup()
 {
     if (File.Exists(MyVariables.fileName))
     {
         File.Delete(MyVariables.fileName);
     }
     csvLogger = new nk.logger.csv.Logger();
 }
예제 #3
0
        /// <summary>
        /// Initiate an instance of Logger class.
        /// </summary>
        public CsvLogger()
        {
            var config = new nk.logger.csv.LoggerConfig();

            config.SetDateTimeFormat(Config.Logger.DateFormat)
            .SetFileName(Config.Logger.FileName)
            .SetRelativePath(Config.Logger.RelativePath)
            .SetReplacementValue(Config.Logger.ReplacementValue);

            csvLogger = new nk.logger.csv.Logger(config);
        }
예제 #4
0
 public Logger()
 {
     csvLogger = new nk.logger.csv.Logger();
 }
예제 #5
0
 /// <summary>
 /// Initiate an instance of Logger class.
 /// </summary>
 /// <param name="dateFormat">Date Time format.</param>
 /// <param name="fileName">Name of the log file. Without extension</param>
 /// <param name="relativePath">Relative path from Base directory.</param>
 /// <param name="replacementValue">Value to replace comma (,) with. Uses semicolon by default.</param>
 public CsvLogger(string dateFormat, string fileName, string relativePath = "", char replacementValue = ';')
 {
     csvLogger = new nk.logger.csv.Logger(dateFormat, fileName, relativePath, replacementValue);
 }