Exemplo n.º 1
0
        public override void GetWriterStream(params bool[] force)
        {
            if (!string.IsNullOrEmpty(v_filename))
            {
                //v_stream = FileHandler.GetFileWriteHandle(v_filename, Layout.NeedsStream);
                if (force.Length > 0)
                {
                    v_stream = FileHandler.GetFileWriteHandle(v_filename, force[0]);
                }
                else
                {
                    v_stream = FileHandler.GetFileWriteHandle(v_filename, false);
                }
                Layout.LogStream = v_stream;
                Layout.LogFile   = v_filename;
                TextWriter tw = new StreamWriter(v_stream);

                Layout.InitLayout(tw);
                Writer = tw;

                Writer.Flush();

                //Create a file watcher.
                fileWatcher = new FileWatcher(v_filename, NotifyFilters.Size);
                fileWatcher.FileChangedHandler = this.OnFileLimitReached;
                fileWatcher.BeginMonitor();
            }
        }