Beispiel #1
0
        private static void Main(string[] args)
        {
            Mappings.Initialize();

            LoggingService = new ConsoleLoggingService();
            var started = DateTime.Now;

            LoggingService.Notice("------------------------------------------------------------------------------------------------------");
            LoggingService.Notice("Miracle Devs - Paradigm.ORM");
            LoggingService.Notice("DbFirst Tool");
            LoggingService.Notice("");
            LoggingService.Notice($"Started at: {started}");
            LoggingService.Notice("------------------------------------------------------------------------------------------------------");

            ParseCommandLine(args);

            var ended = DateTime.Now;

            LoggingService.Notice("------------------------------------------------------------------------------------------------------");
            LoggingService.Notice($"Ended at: {ended}");
            LoggingService.Notice($"Elapsed: { new TimeSpan(ended.Subtract(started).Ticks).TotalSeconds } sec");
            LoggingService.Notice("------------------------------------------------------------------------------------------------------");

#if DEBUG
            Console.ReadKey();
#endif
        }
Beispiel #2
0
        public bool LogAndGetSuccessStatus()
        {
            var primaryLoggingService = new ConsoleLoggingService();

            var v = new LogAction(primaryLoggingService);

            return(v.LoggingWasSuccessful("Hello world!", SharedData.AppSecrets.CroweExercise_Execution_Env, DateTime.UtcNow));
        }
Beispiel #3
0
        public override void Initialize()
        {
            Logger = new ConsoleLoggingService();

            AppDomain.CurrentDomain.UnhandledException += AppDomain_UnhandledException;

            TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;

            base.Initialize();

            Logger = Container.Resolve <ILogger>();
            Log.Listeners.Add(Container.Resolve <FormsLogListener>());
        }
        protected override void Initialize()
        {
            Resources = new DefaultResources();
            Logger    = new ConsoleLoggingService();

            AppDomain.CurrentDomain.UnhandledException += AppDomain_UnhandledException;

            TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;

            base.Initialize();

            Logger = Container.Resolve <ILogger>();
            Log.Listeners.Add(Container.Resolve <FormsLogListener>());
            Container.Resolve <IEventAggregator>().GetEvent <NavigationErrorEvent>().Subscribe(OnNavigationError);
        }
Beispiel #5
0
        public void LogErrorTest()
        {
            var source  = "source";
            var message = "message";

            var writer = new Mock <IOutputWriter>();

            var logger = new ConsoleLoggingService(writer.Object);

            logger.LogError(source, message);

            var expectedLog1 = "Error from " + source + ": " + message;

            writer.Verify(w => w.WriteLine(It.Is <string>(s => s == expectedLog1)), Times.Once);
        }
Beispiel #6
0
        public override void Initialize()
        {
            Logger = new ConsoleLoggingService();

            AndroidEnvironment.UnhandledExceptionRaiser += AndroidEnvironment_UnhandledExceptionRaiser;

            Thread.DefaultUncaughtExceptionHandler = new ExceptHandler(TrackError);

            AppDomain.CurrentDomain.UnhandledException += AppDomain_UnhandledException;

            TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;

            base.Initialize();

            Logger = Container.Resolve <ILogger>();
            Log.Listeners.Add(Container.Resolve <FormsLogListener>());
        }
Beispiel #7
0
        public void LogWarningWithExceptionTest()
        {
            var source    = "source";
            var message   = "message";
            var exception = new Exception("exception");

            var writer = new Mock <IOutputWriter>();

            var logger = new ConsoleLoggingService(writer.Object);

            logger.LogWarning(source, message, exception);

            var expectedLog1 = "Warning from " + source + ": " + message;
            var expectedLog2 = "Exception logged: " + exception.Message;

            writer.Verify(w => w.WriteLine(It.Is <string>(s => s == expectedLog1)), Times.Once);
            writer.Verify(w => w.WriteLine(It.Is <string>(s => s == expectedLog2)), Times.Once);
        }
        protected override void Initialize()
        {
            Resources = new DefaultResources();
            Logger    = new ConsoleLoggingService();

            AndroidEnvironment.UnhandledExceptionRaiser += AndroidEnvironment_UnhandledExceptionRaiser;

            Thread.DefaultUncaughtExceptionHandler = new ExceptHandler(TrackError);

            AppDomain.CurrentDomain.UnhandledException += AppDomain_UnhandledException;

            TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;

            base.Initialize();

            Logger = Container.Resolve <ILogger>();
            Log.Listeners.Add(new FormsLogListener(Logger));
            Container.Resolve <IEventAggregator>().GetEvent <NavigationErrorEvent>().Subscribe(OnNavigationError);
        }