Example #1
0
        static void CreateLogger()
        {
            var logPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "ClientBillingCopy");

            if (!Directory.Exists(logPath))
            {
                Directory.CreateDirectory(logPath);
            }

            Log.Logger = new LoggerConfiguration()
                         .MinimumLevel.ControlledBy(new(LogEventLevel.Information))
                         .MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
                         .MinimumLevel.Override("System", LogEventLevel.Warning)
                         .Enrich.FromLogContext()
                         .WriteTo.Console(
                outputTemplate: "[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}",
                theme: AnsiConsoleTheme.Literate)
                         .WriteTo.File(
                path: Path.Combine(logPath, "log-.log"),
                rollOnFileSizeLimit: true,
                rollingInterval: RollingInterval.Hour,
                shared: true,
                flushToDiskInterval: TimeSpan.FromSeconds(10),
                outputTemplate: "[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}")
                         .CreateLogger();
        }
Example #2
0
        public override string ToString()
        {
            var meString = new StringBuilder();

            meString.AppendLine("Prerequisites:");
            meString.AppendLine(String.Format("Level: {0}", MinimumLevel.ToString()));
            meString.AppendLine(MinimumStats.ToVerticalString(true));

            return(meString.ToString());
        }
Example #3
0
        public override int GetHashCode()
        {
            int hashCode = 0;

            unchecked {
                hashCode += 1000000007 * Type.GetHashCode();
                hashCode += 1000000009 * Cost.GetHashCode();
                hashCode += 1000000021 * MinimumLevel.GetHashCode();
                hashCode += 1000000033 * NumTargets.GetHashCode();
                hashCode += 1000000087 * unknown1.GetHashCode();
            }
            return(hashCode);
        }
Example #4
0
        private static void ConfigureLogging()
        {
            Log.Logger = new LoggerConfiguration()
                         .Enrich.With(new ThreadIdEnricher())
                         .WriteTo.Sink(new FileSink(@"bf.logs.json", new JsonFormatter(false, null, true), null), LogEventLevel.Verbose)
                         .WriteTo.RollingFile("bf.log", LogEventLevel.Verbose)
                         .WriteTo.ColoredConsole(
                outputTemplate: "{Timestamp:HH:mm} [{Level}] ({ThreadId}) {Message}{NewLine}{Exception}",
#if !DEBUG
                restrictedToMinimumLevel: LogEventLevel.Error
#else
                restrictedToMinimumLevel: LogEventLevel.Verbose
#endif
                )
                         .MinimumLevel.Debug()
                         .CreateLogger();
        }
Example #5
0
        protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            ele.TryPathTo("Ownership/Owner", true, out subEle);
            Owner.WriteXML(subEle, master);

            ele.TryPathTo("Ownership/Rank", true, out subEle);
            subEle.Value = OwnerRank.ToString();

            ele.TryPathTo("MinimumLevel", true, out subEle);
            subEle.Value = MinimumLevel.ToString();

            ele.TryPathTo("Flags", true, out subEle);
            subEle.Value = Flags.ToString();

            WriteUnusedXML(ele, master);
        }
Example #6
0
        public DefaultLoggerConfiguration(LogEventLevel level = LogEventLevel.Verbose, string fileName = null)
        {
            Enrich.FromLogContext();
            if (fileName != null)
            {
                WriteTo.File(fileName, level, DefaultTemplate);
            }
            else
            {
                WriteTo.RollingFile(".\\Logs\\log_{HalfHour}.txt", level, DefaultTemplate);
            }

            MinimumLevel.Is(level);
            Destructure.ByTransforming <Money>(r => new { r.Amount, r.CurrencyCode });
            Destructure.ByTransforming <Exception>(r => new { Type = r.GetType(), r.Message, r.StackTrace });
            Destructure.ByTransforming <MessageMetadata>(r => new { r.CasuationId, r.CorrelationId });
            Destructure.ByTransforming <PersistEventPack>(r => new { Size = r.Events?.Length });
            Destructure.ByTransforming <MessageMetadataEnvelop <ICommand> >(r => new { CommandType = r.Message.GetType(), CommandId = r.Message.Id, r.Metadata });
            Destructure.ByTransforming <MessageMetadataEnvelop <DomainEvent> >(r => new { EventType = r.Message.GetType(), EventId = r.Message.Id, r.Metadata });
            Destructure.ByTransforming <AggregateCommandExecutionContext>(r => new { CommandId = r.Command?.Id, Metadata = r.CommandMetadata });
            Destructure.ByTransforming <ProcessesTransitComplete>(r => new { Event = r.InitialMessage, ProducedCommandsNum = r.ProducedCommands.Length });
            Destructure.ByTransforming <CreateNewProcess>(r => new { Event = (r.Message?.Message as IHaveId)?.Id ?? r.Message?.Message, r.EnforcedId, r.Message?.Metadata });
        }
Example #7
0
 public override int GetHashCode()
 {
     return(MinimumLevel.GetHashCode());
 }
Example #8
0
        public bool Equals(DestinyVendorItemDefinition input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     VendorItemIndex == input.VendorItemIndex ||
                     (VendorItemIndex.Equals(input.VendorItemIndex))
                     ) &&
                 (
                     ItemHash == input.ItemHash ||
                     (ItemHash.Equals(input.ItemHash))
                 ) &&
                 (
                     Quantity == input.Quantity ||
                     (Quantity.Equals(input.Quantity))
                 ) &&
                 (
                     FailureIndexes == input.FailureIndexes ||
                     (FailureIndexes != null && FailureIndexes.SequenceEqual(input.FailureIndexes))
                 ) &&
                 (
                     Currencies == input.Currencies ||
                     (Currencies != null && Currencies.SequenceEqual(input.Currencies))
                 ) &&
                 (
                     RefundPolicy == input.RefundPolicy ||
                     (RefundPolicy != null && RefundPolicy.Equals(input.RefundPolicy))
                 ) &&
                 (
                     RefundTimeLimit == input.RefundTimeLimit ||
                     (RefundTimeLimit.Equals(input.RefundTimeLimit))
                 ) &&
                 (
                     CreationLevels == input.CreationLevels ||
                     (CreationLevels != null && CreationLevels.SequenceEqual(input.CreationLevels))
                 ) &&
                 (
                     DisplayCategoryIndex == input.DisplayCategoryIndex ||
                     (DisplayCategoryIndex.Equals(input.DisplayCategoryIndex))
                 ) &&
                 (
                     CategoryIndex == input.CategoryIndex ||
                     (CategoryIndex.Equals(input.CategoryIndex))
                 ) &&
                 (
                     OriginalCategoryIndex == input.OriginalCategoryIndex ||
                     (OriginalCategoryIndex.Equals(input.OriginalCategoryIndex))
                 ) &&
                 (
                     MinimumLevel == input.MinimumLevel ||
                     (MinimumLevel.Equals(input.MinimumLevel))
                 ) &&
                 (
                     MaximumLevel == input.MaximumLevel ||
                     (MaximumLevel.Equals(input.MaximumLevel))
                 ) &&
                 (
                     Action == input.Action ||
                     (Action != null && Action.Equals(input.Action))
                 ) &&
                 (
                     DisplayCategory == input.DisplayCategory ||
                     (DisplayCategory != null && DisplayCategory.Equals(input.DisplayCategory))
                 ) &&
                 (
                     InventoryBucketHash == input.InventoryBucketHash ||
                     (InventoryBucketHash.Equals(input.InventoryBucketHash))
                 ) &&
                 (
                     VisibilityScope == input.VisibilityScope ||
                     (VisibilityScope != null && VisibilityScope.Equals(input.VisibilityScope))
                 ) &&
                 (
                     PurchasableScope == input.PurchasableScope ||
                     (PurchasableScope != null && PurchasableScope.Equals(input.PurchasableScope))
                 ) &&
                 (
                     Exclusivity == input.Exclusivity ||
                     (Exclusivity != null && Exclusivity.Equals(input.Exclusivity))
                 ) &&
                 (
                     IsOffer == input.IsOffer ||
                     (IsOffer != null && IsOffer.Equals(input.IsOffer))
                 ) &&
                 (
                     IsCrm == input.IsCrm ||
                     (IsCrm != null && IsCrm.Equals(input.IsCrm))
                 ) &&
                 (
                     SortValue == input.SortValue ||
                     (SortValue.Equals(input.SortValue))
                 ) &&
                 (
                     ExpirationTooltip == input.ExpirationTooltip ||
                     (ExpirationTooltip != null && ExpirationTooltip.Equals(input.ExpirationTooltip))
                 ) &&
                 (
                     RedirectToSaleIndexes == input.RedirectToSaleIndexes ||
                     (RedirectToSaleIndexes != null && RedirectToSaleIndexes.SequenceEqual(input.RedirectToSaleIndexes))
                 ) &&
                 (
                     SocketOverrides == input.SocketOverrides ||
                     (SocketOverrides != null && SocketOverrides.SequenceEqual(input.SocketOverrides))
                 ) &&
                 (
                     Unpurchasable == input.Unpurchasable ||
                     (Unpurchasable != null && Unpurchasable.Equals(input.Unpurchasable))
                 ));
        }