Beispiel #1
0
        protected void btnFileLogger_OnClick(object sender, EventArgs e)
        {
            var message = txtMessage.Text;
            var logger  = new FileLogger(@"C:\Test\AFTPPath\log.txt");

            logger.Log(1, message);
        }
Beispiel #2
0
 public HtmlRecorder()
 {
     pLogFileName = FileUtils.Relative2AbsolutePath(
         FileUtils.CombineWinPath(pLogFolder,
             FileUtils.MakeValidFileName(DateTime.Now.ToString()) + pLogExtension));
     pLog = new FileLogger(pLogFileName);
     pLog.Log(pLogHeader, false);
     pImagesFolder = pLogFileName + pImagesFolderExtension;
     Directory.CreateDirectory(pImagesFolder);
 }
        public static void Main()
        {
            var consoleLogger = new ConsoleLogger();

            consoleLogger.Log(2, "Hack BG Warning Test");

            var fileLogger = new FileLogger();

            fileLogger.Log(1, "Hack BG Info Test");
        }
Beispiel #4
0
        protected override void SubClassLog(string msg)
        {
            ILogger consoleLogger = new ConsoleLogger();

            consoleLogger.Log(msg);

            ILogger fileLogger = new FileLogger(fileName);

            fileLogger.Log(msg);
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            string today = DateTime.Now.ToString("yyyyMMdd");
            Logger lg    = new Logger();
            //Logger._fileName = Logger._filePath + Logger._fileName + "_" + today + Logger._logSeq.ToString().PadLeft(Logger._logSeqLength - Logger._logSeq.ToString().Length, '0') + ".txt";
            string     FileName = lg.GetFileName();
            FileLogger fl       = new FileLogger();
            Message    msg      = new Message(Logger.LogType.Info, "Ilan", "Hello World");

            //Enumerable.Range(0, 2000)
            //.ToList()
            //.ForEach(x => fl.Log(FileName, msg.ToString(), true));

            fl.Log(FileName, msg.ToString(), true);
            List <string> fileNames = Logger.GetFileCollection("20190520");

            fl.Log(@"C:\Temp\Collection.txt", String.Join(", ", fileNames.ToArray()), false);

            Console.ReadLine();
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            //test code
            LogHelper.Log(LogTarget.File, "text to file");

            FileLogger customPath = new FileLogger("customfile.txt");

            customPath.Log("test");

            LogHelper.Log(LogTarget.Console, "console test 2");
            LogHelper.Log(LogTarget.Console, "console test 3");

            Console.ReadLine();
        }
Beispiel #7
0
 static void Main(string[] args)
 {
     /*
      *
      * logger class plugin code
      *  Depending on the need, logger class can either log in the database or file
      *  and can be extended to other output formats like an event log
      *
      */
     try
     {
         var logger = new FileLogger("Whatever the path is", null);
         logger.Log("Message");
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }