コード例 #1
0
ファイル: FileNotifier.cs プロジェクト: dansam100/Logger
 /// <summary>
 /// initialize the writer stream
 /// </summary>
 internal override void InitWriterStream()
 {
     //TOD0: make this concatenate to the current file somehow since logging is done daily.
     //put an attribute in config (append should work) to specify if new file should be generated for each interrupt of service or not.
     if (v_filename != null && this.Layout != null)
     {
         ITokenizer t = Tokenizer.CreateTokenizer(v_filename);
         if (t.Tokens.Length > 0)
         {
             v_filename = t.MatchAndReplace(TokenType.date, v_filename, DateTime.Now.ToString("dd-MM-yyyy"));
             v_filename = t.MatchAndReplace(TokenType.assembly, v_filename, Assembly.GetEntryAssembly().GetName().Name);
             v_filename = t.MatchAndReplace(TokenType.extension, v_filename,
                                            (this.Layout.ContentType.Split('/').Length > 1) ? this.Layout.ContentType.Split('/')[1] : this.Layout.ContentType);
         }
         base.Mode      = LogMode.Immediate;
         Layout.LogFile = v_filename;
         SIZE_THRESHOLD = (int)(0.15 * MaxFileSize) + base.v_writer.Encoding.GetByteCount(Layout.StartValue) / 1024;
     }
     GetWriterStream(true);
 }