Exemple #1
0
        public LogToFileBehavior(StreamWriter writer, IMessageFormatBehavior messageFormatBehavior, string logPath = @".\Log")
        {
            MessageFormatBehavior = messageFormatBehavior;
            _logPath  = logPath;
            _initDate = DateTime.Now;

            if (!Directory.Exists(_logPath))
            {
                Directory.CreateDirectory(_logPath);
            }

            StartLogging(writer ?? OpenFile(Path.Combine(_logPath, _initDate.ToString("yyyy-MM-dd_HH-mm-ss")) + ".txt"));
        }
Exemple #2
0
 public LogToDebugViewBehavior(IMessageFormatBehavior messageFormatBehavior)
 {
     _initDate             = DateTime.Now;
     MessageFormatBehavior = messageFormatBehavior;
 }
Exemple #3
0
 public LogToFileBehavior(IMessageFormatBehavior messageFormatBehavior, string logPath = @".\Log")
     : this(null, messageFormatBehavior, logPath)
 {
 }
Exemple #4
0
 public LogToConsoleBehavior(IMessageFormatBehavior messageFormatBehavior)
 {
     MessageFormatBehavior = messageFormatBehavior;
     _initDate             = DateTime.Now;
 }