Example #1
0
 public ActionResult Save(Bam.Net.Logging.Data.LogEvent[] values)
 {
     try
     {
         LogEventCollection saver = new LogEventCollection();
         saver.AddRange(values);
         saver.Save();
         return(Json(new { Success = true, Message = "", Dao = "" }));
     }
     catch (Exception ex)
     {
         return(GetErrorResult(ex));
     }
 }
Example #2
0
    static void Main(string[] args)
    {
        Log.Logger = new LoggerConfiguration()
                     .WriteTo.Console()
                     .CreateLogger();
        var collection = new LogEventCollection();
        // Create an `ILogger` with the collector wired in. This
        // also works with `LogContext.Push()`.
        var collected = Log.ForContext(collection);

        collected.Information("Hello");
        collected.Information("World");
        // One entry for each call above
        foreach (var evt in collection.Events)
        {
            Console.WriteLine(evt.RenderMessage(null));
        }
    }
Example #3
0
        public XmlLogger()
        {
            AppDomain.CurrentDomain.DomainUnload += new EventHandler(OnDomainUnload);
            this.Verbosity = 4;

            this.Folder = new DirectoryInfo(GetAppDataFolder());
            this.FileNumber = 1;
            this.FileExtension = "xml";
            this.MaxEntriesPerFile = 20;
            this.SetNextFileInfo();

            if (File.Exists)
            {
                _xmlLog = File.FullName.FromXmlFile<LogEventCollection>();
            }
            else
            {
                _xmlLog = new LogEventCollection();
            }

            //this.RestartLoggingThread();
        }