Beispiel #1
0
        public void Log(LogClass lClass, string message)
        {
            var log = string.Format("[{3}] {0} ==> {1}{2}", DateTime.Now.ToString("HH:mm:ss.fff"), message.Trim(), Environment.NewLine, lClass.ToString().ToUpper());

            using (FileStream fileStream = File.Open(LogFile, FileMode.OpenOrCreate, FileAccess.ReadWrite))
            {
                StreamWriter sw       = new StreamWriter(fileStream);
                long         endPoint = fileStream.Length;
                // Set the stream position to the end of the file.
                fileStream.Seek(endPoint, SeekOrigin.Begin);
                sw.Write(log);
                sw.Flush();
            }
        }