Exemplo n.º 1
0
        public FileLogStream(string path, bool append, Encoding encoding)
        {
            Filter = new DebugLogFilter();

            var file = new FileInfo(path);

            file.Directory.Create();

            var prevFile = new FileInfo(Path.Combine(file.Directory.FullName, Path.GetFileNameWithoutExtension(path) + "_Prev" + Path.GetExtension(path)));

            if (prevFile.Exists)
            {
                prevFile.Delete();
            }
            if (file.Exists)
            {
                file.MoveTo(prevFile.FullName);
            }

            Writer           = new StreamWriter(path, append, encoding);
            Writer.AutoFlush = true;

            WriteHeader();
        }
Exemplo n.º 2
0
        public FileLogStream(string path, bool append, Encoding encoding)
        {
            Filter = new DebugLogFilter();

            var file = new FileInfo(path);
            file.Directory.Create();

            var prevFile = new FileInfo(Path.Combine(file.Directory.FullName, Path.GetFileNameWithoutExtension(path) + "_Prev" + Path.GetExtension(path)));
            if (prevFile.Exists)
            {
                prevFile.Delete();
            }
            if (file.Exists)
            {
                file.MoveTo(prevFile.FullName);
            }

            Writer = new StreamWriter(path, append, encoding);
            Writer.AutoFlush = true;

            WriteHeader();
        }