Esempio n. 1
0
        public static void Main(string[] args)
        {
            var log = new RiZhi
            {
                FilePrefix      = "ExampleApp",
                AssemblyVersion = "1.0.0",
                AssemblyName    = "Example Program"
            };

            log.Debug("Debug message, appears first");
            log.Information("Information message, appears second");
            log.Warning($"Warning message, appears third. Error Flag = {log.ErrorFlag}");
            log.Error("Error message, appears fourth");

            if (log.ErrorFlag)
            {
                log.Debug($"Error was logged");
            }

            log.WriteLog();
        }
Esempio n. 2
0
        public async Task ClearImageCache(string path)
        {
            var dirInfo = new DirectoryInfo(path);
            await Task.Run(() =>
            {
                foreach (var image in dirInfo.EnumerateFiles("*.png"))
                {
                    _log.Debug("Deleting cache image: " + image.FullName);

                    File.Delete(image.FullName);
                }
            }).ConfigureAwait(true);
        }
Esempio n. 3
0
        public async Task ClearImageCache(string path)
        {
            var dirInfo = new DirectoryInfo(path);

            // short circuit if directory does not exist
            if (!dirInfo.Exists)
            {
                return;
            }

            await Task.Run(() =>
            {
                foreach (var image in dirInfo.EnumerateFiles("*.png"))
                {
                    _log.Debug("Deleting cache image: " + image.FullName);

                    File.Delete(image.FullName);
                }
            }).ConfigureAwait(true);
        }