Exemplo n.º 1
0
Arquivo: Log.cs Projeto: mind0n/hive
		private static void Queue_OnDequeue(Entry entry)
		{
			foreach (var i in logger)
			{
				i.Log(entry);
			}
		}
Exemplo n.º 2
0
		public void Enqueue(Entry item)
		{
			if (OnDequeue != null)
			{
				queue.Enqueue(item);
			}
			mre.Set();
		}
Exemplo n.º 3
0
	    public virtual void Log(string msg, string src = null, string category = null, string session = null, Level lvl = Level.Info)
	    {
		    dynamic entry = new Entry();
		    Dobj.Settings(entry).AutoCreate = true;
		    entry.Level = lvl;
		    entry.Message = msg;
		    entry.Category = category ?? "Log";
		    entry.Source = src ?? Assembly.GetCallingAssembly().FullName;
		    entry.Session = session;
			Log(entry);
	    }
Exemplo n.º 4
0
 public virtual void save()
 {
     using (var db = new OfficeLog())
     {
         var entry = new Entry
         {
             LogDate = DateTime.Now,
             LogText = newEntryText.Rtf
         };
         db.Entries.Add(entry);
         int recordsAffected = db.SaveChanges();
     }
     logger.refreshScreen();
     Dispose();
 }
Exemplo n.º 5
0
Arquivo: Log.cs Projeto: mind0n/hive
		private static void w(string msg, string source, string category, Level level, string session)
		{
			dynamic entry = new Entry();
			entry.Message = msg;
			entry.Session = session;
			entry.Category = category;
			entry.Level = level;
			entry.Source = Assembly.GetCallingAssembly().GetName().Name;
			if (!prevtime.HasValue)
			{
				entry.Duration = -1;
			}
			else
			{
				entry.Duration = (DateTime.Now - prevtime.Value).Milliseconds;
			}
			prevtime = DateTime.Now;
			queue.Enqueue(entry);
		}
Exemplo n.º 6
0
		private void write2file(Entry entry)
		{
			var content = FormatContent(entry);
			var msg = FormatMessage(entry, content);
			File.AppendAllText(file, msg);
		}
Exemplo n.º 7
0
 public List <Entry> GetLog()
 {
     EntryLog = Entry.Deserialize();
     return(EntryLog);
 }
Exemplo n.º 8
0
 public Main()
 {
     Entry.OpenOrCreateFile();
     EntryLog = Entry.Deserialize();
 }
Exemplo n.º 9
0
		private void write2console(Entry entry)
		{
			var content = FormatContent(entry);
			Console.WriteLine(content);
		}