Exemple #1
0
 public static void WriteLogo()
 {
     Log.Verbose(AnsiColor.ReplaceColors("{M___________________________________________________________________{n"));
     Log.Verbose(AnsiColor.ReplaceColors("{M_{Yoo{M____{Yoo{M______________________________{Yooo{M_____{Yooo{M______________{Yoo{M_{n"));
     Log.Verbose(AnsiColor.ReplaceColors("{M_{Yoo{M___{Yoo{M__{Yoo{M____{Yo{M_{Yoo{M_{Yoo{M_{Yoo{M__{Yoo{M____{Yo{M____{Yoooo{M___{Yoooo{M_{Yoo{M____{Yo{M__{Yoooooo{M_{n"));
     Log.Verbose(AnsiColor.ReplaceColors("{M_{Yoo{M__{Yoo{M___{Yoo{M____{Yo{M_{Yooo{M_{Yoo{M__{Yo{M_{Yoo{M____{Yo{M____{Yoo{M_{Yoo{M_{Yoo{M_{Yoo{M_{Yoo{M____{Yo{M_{Yoo{M___{Yoo{M_{n"));
     Log.Verbose(AnsiColor.ReplaceColors("{M_{Yoooooo{M___{Yoo{M____{Yo{M_{Yoo{M__{Yoo{M__{Yo{M_{Yoo{M____{Yo{M____{Yoo{M__{Yooo{M__{Yoo{M_{Yoo{M____{Yo{M_{Yoo{M___{Yoo{M_{n"));
     Log.Verbose(AnsiColor.ReplaceColors("{M_{Yoo{M___{Yoo{M__{Yooo{M___{Yo{M_{Yoo{M__{Yoo{M__{Yo{M_{Yooo{M___{Yo{M____{Yoo{M_______{Yoo{M_{Yooo{M___{Yo{M_{Yoo{M___{Yoo{M_{n"));
     Log.Verbose(AnsiColor.ReplaceColors("{M_{Yoo{M____{Yoo{M_{Yoo{M_{Yooo{M__{Yoo{M______{Yo{M_{Yoo{M_{Yooo{M_____{Yoo{M_______{Yoo{M_{Yoo{M_{Yooo{M___{Yoooooo{M_{n"));
     Log.Verbose(AnsiColor.ReplaceColors("{M___________________________________________________________________{n"));
 }
Exemple #2
0
        /// <summary>
        /// Process a shutdown with a text message, this fires off a warning since a shutdown is
        /// essentially warning-worthy in my opinion. Yours may vary ;-)
        /// </summary>
        /// <param name="msg">The message to process with exception</param>
        /// <param name="e">Any exception passed or null</param>
        /// <param name="level">The level of the message to log</param>
        public static void Shutdown(string msg, Exception e = null, LogLevel level = LogLevel.Warning)
        {
            string smsg = AnsiColor.ReplaceColors(msg + (e == null ? "" : "Exception: " + e.Message));

            Core.LogMsg(smsg, level);
            Environment.Exit(-1);
            //TODO: Why does this barf? [note from the future: who cares? - km]
            //var methodInfo = Log.Logger.GetType().GetMethod(level.ToString(), new Type[] { typeof(string) });
            //object[] parametersArray = new object[] { smsg };
            //methodInfo.Invoke(Log.Logger, parametersArray);
        }
Exemple #3
0
        static void Main(string[] args)
        {
            const string template = "{Timestamp:yy-MM-dd HH:mm:ss} [{Level}] {Indent:l}{Message}{NewLine}{Exception}";

            ParseOptions(args);
            Log.Logger = new LoggerConfiguration()
                         .MinimumLevel.Verbose()
                         .WriteTo.Console()
                         .WriteTo.Logger(
                x => x.Filter.ByIncludingOnly(e => e.Level == LogEventLevel.Fatal)
                .WriteTo.File($"logs/driver-fatal.log",
                              rollingInterval: RollingInterval.Day,
                              rollOnFileSizeLimit: true,
                              outputTemplate: template)
                )
                         .WriteTo.Logger(
                x => x.Filter.ByIncludingOnly(e => e.Level is LogEventLevel.Warning
                                              or LogEventLevel.Error)
                .WriteTo.File($"logs/driver-errors.log",
                              rollingInterval: RollingInterval.Day,
                              rollOnFileSizeLimit: true,
                              outputTemplate: template)
                )
                         .WriteTo.Logger(
                x => x.Filter.ByExcluding(e => e.Level is LogEventLevel.Warning
                                          or LogEventLevel.Error or LogEventLevel.Fatal or LogEventLevel.Verbose)
                .WriteTo.File($"logs/mud-info.log",
                              rollingInterval: RollingInterval.Day,
                              rollOnFileSizeLimit: true,
                              outputTemplate: template)
                ).CreateLogger();

            // Removed capturing of Ctrl-C since it failed across platforms
            // evaluate adding back later.
            Log.Information(AnsiColor.ReplaceColors("{GBringing the hyper-drive systems online...{n"));
            Core.StartKernel(Uid.Kernel);
        }