示例#1
0
 public GuildConfig Into() =>
 new GuildConfig
 {
     Id           = Id,
     LogChannel   = LogChannel,
     LogBlacklist = new HashSet <ulong>(LogBlacklist?.Select(c => (ulong)c) ?? new ulong[] {}),
     Blacklist    = new HashSet <ulong>(Blacklist?.Select(c => (ulong)c) ?? new ulong[] {})
 };
示例#2
0
        private static void AddBlacklist(IServiceCollection services, List <string> loggerBlacklist)
        {
            var blacklist = new LogBlacklist();

            if ((loggerBlacklist?.Any()).GetValueOrDefault())
            {
                blacklist.AddRange(loggerBlacklist);
            }

            services.AddSingleton(lb => blacklist);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ServerlessLogger"/> class.
        /// </summary>
        /// <param name="loggerFactory">See <see cref="ILoggerFactory"/>.</param>
        /// <param name="transactionFlow">See <see cref="ITransactionFlow"/>.</param>
        /// <param name="logBlacklist">Logger blacklist with sensitive fields to be masked.</param>
        public ServerlessLogger(
            ILoggerFactory loggerFactory,
            ITransactionFlow transactionFlow,
            LogBlacklist logBlacklist)
        {
            this.logBlacklist    = logBlacklist;
            this.transactionFlow = transactionFlow;

            Logger = loggerFactory
                     .CreateLogger <ServerlessLogger>();
        }