Beispiel #1
0
        public EntryLog(ILogHandler logHandler, LogInterval?logInterval = null, Uri logfolderPath = null)
        {
            this.logHandler = logHandler;
            Log_Interval    = logInterval.HasValue ? logInterval.Value : LogInterval.EveryMinute;

            if (logfolderPath == null)
            {
                LogPath = new Uri(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location));
            }
            else
            {
                LogPath = logfolderPath;
            }
        }
Beispiel #2
0
        /// <summary>
        /// It takes two parameters:
        /// - Log Interval
        /// - Uri path to a folder
        /// Writes logs to the default execution path, with a default interval.
        /// </summary>
        /// <param name="logfolderPath"></param>
        public static IServiceCollection AddEntryLog(this IServiceCollection services, LogInterval logInterval, Uri logfolderPath)
        {
            services.AddSingleton <ILogHandler, LogProcessorHandler>();
            services.AddSingleton <IEntryLog, EntryLog>(v => new EntryLog(v.GetRequiredService <ILogHandler>(), logInterval, logfolderPath));

            return(services);
        }