Exemple #1
0
        static void RegisterLogging(IEnvironmentInformation environment, ContainerBuilder builder)
        {
            if (!environment.GetIsInDesignTime())
            {
                var logPath = !environment.GetIsDebugging() && environment.GetIsRunningDeveloperVersion() ?
                              Path.GetTempFileName() :
                              FileManager.GetFullPathFromTemporaryPath("Shapeshifter.log");

                Log.Logger = new LoggerConfiguration()
                             .MinimumLevel.Verbose()
                             .Enrich.WithProperty("ProcessId", Process.GetCurrentProcess().Id)
                             .Enrich.FromLogContext()
                             .WriteTo.Debug(
                    outputTemplate: "{Timestamp:HH:mm:ss.fff} [{Level:u3}] {Message:lj} ({SourceContext:l}){NewLine}{Exception}")
                             .WriteTo.File(
                    logPath,
                    restrictedToMinimumLevel: LogEventLevel.Verbose,
                    fileSizeLimitBytes: int.MaxValue,
                    rollOnFileSizeLimit: false,
                    rollingInterval: RollingInterval.Day,
                    retainedFileCountLimit: 2,
                    shared: true,
                    outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff} [#{ProcessId}] [{SourceContext:l}] [{Level:u3}]{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}")
                             .WriteTo.Sink(new IssueReporterSink(environment))
                             .CreateLogger();
            }

            builder.RegisterLogger(autowireProperties: true);
        }
Exemple #2
0
 public ClipboardFileDataViewModel(
     IEnvironmentInformation environmentInformation)
 {
     if (environmentInformation.GetIsInDesignTime())
     {
         PrepareDesignerMode();
     }
 }