Example #1
0
        public static void Execute()
        {
            Fibonacci(5);


            Task.WaitAll(
                LoggedProgram.ReadAndHashAsync("https://www.nasa.gov/sites/default/files/styles/full_width_feature/public/thumbnails/image/pineisland_oli_2017026_lrg-crop.jpg"),
                LoggedProgram.ReadAndHashAsync("https://www.nasa.gov/sites/default/files/styles/full_width_feature/public/thumbnails/image/pia20521-1041.jpg"));

            var activity = logger.OpenActivity("Hashing images without logging");

            try
            {
                logger.Write(LogLevel.Info, "Disabling debug logging the WebUtil.");
                LoggingServices.DefaultBackend.GetSource(LoggingRoles.Tracing, typeof(LoggedProgram)).SetLevel(LogLevel.Info);
                Task.WaitAll(
                    LoggedProgram.ReadAndHashAsync("https://www.nasa.gov/sites/default/files/styles/full_width_feature/public/thumbnails/image/pineisland_oli_2017026_lrg-crop.jpg"),
                    LoggedProgram.ReadAndHashAsync("https://www.nasa.gov/sites/default/files/styles/full_width_feature/public/thumbnails/image/pia20521-1041.jpg"));

                activity.SetSuccess();
            }
            catch (Exception e)
            {
                activity.SetException(e);
                throw;
            }

            UpdateCustomer(5, new CustomerData {
                FirstName = "Joe", LastName = "Brick"
            });
        }
Example #2
0
        static void Main(string[] args)
        {
            var backend = new Patterns.Diagnostics.Backends.Console.ConsoleLoggingBackend();

            backend.Options.Delimiter      = " \u00A6 ";
            LoggingServices.DefaultBackend = backend;

            LoggingServices.Formatters.Register(new FancyIntFormatter());
            AuditServices.RecordPublished += OnAuditRecordPublished;

            LoggedProgram.Execute();
        }