internal Log4NetConfiguration()
 {
     _repositoryConfiguration = new RepositoryConfiguration(this);
     _loggingConfiguration = new LoggingConfiguration(this);
     _renderingConfiguration = new RenderingConfiguration(this);
 }
Exemplo n.º 2
0
 /// <inheritdoc />
 public ILogger GetLogger <T>(LogEventSendMode mode = LogEventSendMode.Customize,
                              RenderingConfiguration renderingOptions = null)
 {
     return(GetLoggerCore(typeof(T), null, null, null, mode, renderingOptions));
 }
Exemplo n.º 3
0
 /// <inheritdoc />
 public ILogger GetLogger <T>(LogEventLevel minLevel, Func <string, LogEventLevel, bool> filter,
                              LogEventSendMode mode = LogEventSendMode.Customize,
                              RenderingConfiguration renderingOptions = null)
 {
     return(GetLoggerCore(typeof(T), null, minLevel, filter, mode, renderingOptions));
 }
 /// <inheritdoc />
 public ILogger GetLogger(string categoryName, LogEventLevel minLevel, Func <string, LogEventLevel, bool> filter,
                          LogEventSendMode mode = LogEventSendMode.Customize,
                          RenderingConfiguration renderingOptions = null)
 {
     return(GetLoggerCore(null, categoryName, minLevel, filter, mode, renderingOptions));
 }
 /// <inheritdoc />
 public ILogger GetLogger(Type type, LogEventLevel minLevel,
                          LogEventSendMode mode = LogEventSendMode.Customize,
                          RenderingConfiguration renderingOptions = null)
 {
     return(GetLoggerCore(type, null, minLevel, null, mode, renderingOptions));
 }
 /// <inheritdoc />
 public ILogger GetLogger(string categoryName,
                          LogEventSendMode mode = LogEventSendMode.Customize,
                          RenderingConfiguration renderingOptions = null)
 {
     return(GetLoggerCore(null, categoryName, null, null, mode, renderingOptions));
 }
        private ILogger GetLoggerCore(Type sourceType, string categoryName, LogEventLevel?level, Func <string, LogEventLevel, bool> filter,
                                      LogEventSendMode mode = LogEventSendMode.Customize, RenderingConfiguration renderingOptions = null)
        {
            var loggerStateNamespace = sourceType == null ? categoryName : TypeNameHelper.GetTypeDisplayName(sourceType);
            var minLevel             = level ?? _loggingConfiguration.GetMinimumLevel(loggerStateNamespace);

            return(new CosmosLoggerProxy(sourceType ?? typeof(object), minLevel, loggerStateNamespace, filter, mode,
                                         _loggingConfiguration.Rendering.ToCalc(renderingOptions), new LogPayloadSender(_logPayloadClientProviders)));
        }
Exemplo n.º 8
0
        /// <summary>
        ///     Loads configuration from specified file.
        /// </summary>
        /// <param name="path">Path to configuration file.</param>
        /// <returns>New instance of <see cref="Configuration" /> class with data loaded from file or defaults if data was missing.</returns>
        public static Configuration LoadFromFile(string path)
        {
            var jsonSerializerOptions = new JsonSerializerOptions
            {
                ReadCommentHandling = JsonCommentHandling.Skip
            };
            var rawFileContent = File.ReadAllText(path);
            var fileContent    = JsonSerializer.Deserialize <FileContent>(rawFileContent, jsonSerializerOptions);

            if (fileContent is null)
            {
                throw new InvalidOperationException($"Cannot load configuration from file: {path}.");
            }

            var coreConfigurationBuilder = CoreConfiguration.CreateBuilder();

            if (fileContent.Core?.AssetsRootDirectoryPath != null)
            {
                coreConfigurationBuilder.WithAssetsRootDirectoryPath(fileContent.Core.AssetsRootDirectoryPath);
            }
            if (fileContent.Core?.CustomSystemsExecutionOrder != null)
            {
                coreConfigurationBuilder.WithCustomSystemsExecutionOrder(fileContent.Core.CustomSystemsExecutionOrder);
            }
            if (fileContent.Core?.FixedUpdatesPerFrameLimit != null)
            {
                coreConfigurationBuilder.WithFixedUpdatesPerFrameLimit(fileContent.Core.FixedUpdatesPerFrameLimit.Value);
            }
            if (fileContent.Core?.FixedUpdatesPerSecond != null)
            {
                coreConfigurationBuilder.WithFixedUpdatesPerSecond(fileContent.Core.FixedUpdatesPerSecond.Value);
            }
            if (fileContent.Core?.ShowAllEntitiesCount != null)
            {
                coreConfigurationBuilder.WithShowAllEntitiesCount(fileContent.Core.ShowAllEntitiesCount.Value);
            }
            if (fileContent.Core?.ShowRootEntitiesCount != null)
            {
                coreConfigurationBuilder.WithShowRootEntitiesCount(fileContent.Core.ShowRootEntitiesCount.Value);
            }
            if (fileContent.Core?.ShowFps != null)
            {
                coreConfigurationBuilder.WithShowFps(fileContent.Core.ShowFps.Value);
            }
            if (fileContent.Core?.ShowFrameTime != null)
            {
                coreConfigurationBuilder.WithShowFrameTime(fileContent.Core.ShowFrameTime.Value);
            }
            if (fileContent.Core?.ShowTotalFrames != null)
            {
                coreConfigurationBuilder.WithShowTotalFrames(fileContent.Core.ShowTotalFrames.Value);
            }
            if (fileContent.Core?.ShowTotalTime != null)
            {
                coreConfigurationBuilder.WithShowTotalTime(fileContent.Core.ShowTotalTime.Value);
            }
            if (fileContent.Core?.ShowSystemsExecutionTimes != null)
            {
                coreConfigurationBuilder.WithShowSystemsExecutionTimes(fileContent.Core.ShowSystemsExecutionTimes.Value);
            }
            if (fileContent.Core?.StartUpScene != null)
            {
                coreConfigurationBuilder.WithStartUpScene(fileContent.Core.StartUpScene);
            }
            if (fileContent.Core?.StartUpSceneBehavior != null)
            {
                coreConfigurationBuilder.WithStartUpSceneBehavior(fileContent.Core.StartUpSceneBehavior);
            }

            var physicsConfigurationBuilder = PhysicsConfiguration.CreateBuilder();

            if (fileContent.Physics?.RenderCollisionGeometry != null)
            {
                physicsConfigurationBuilder.WithRenderCollisionGeometry(fileContent.Physics.RenderCollisionGeometry.Value);
            }

            var renderingConfigurationBuilder = RenderingConfiguration.CreateBuilder();

            if (fileContent.Rendering?.EnableVSync != null)
            {
                renderingConfigurationBuilder.WithEnableVSync(fileContent.Rendering.EnableVSync.Value);
            }
            if (fileContent.Rendering?.ScreenHeight != null)
            {
                renderingConfigurationBuilder.WithScreenHeight(fileContent.Rendering.ScreenHeight.Value);
            }
            if (fileContent.Rendering?.ScreenWidth != null)
            {
                renderingConfigurationBuilder.WithScreenWidth(fileContent.Rendering.ScreenWidth.Value);
            }
            if (fileContent.Rendering?.SortingLayersOrder != null)
            {
                renderingConfigurationBuilder.WithSortingLayersOrder(fileContent.Rendering.SortingLayersOrder);
            }

            return(new Configuration(
                       coreConfigurationBuilder.Build(),
                       physicsConfigurationBuilder.Build(),
                       renderingConfigurationBuilder.Build()
                       ));
        }
Exemplo n.º 9
0
 private Configuration(CoreConfiguration coreConfiguration, PhysicsConfiguration physics, RenderingConfiguration renderingConfiguration)
 {
     Core      = coreConfiguration;
     Physics   = physics;
     Rendering = renderingConfiguration;
 }
Exemplo n.º 10
0
 /// <inheritdoc />
 public AspectCoreLogger(Type sourceType, LogEventLevel minimumLevel, string loggerStateNamespace, Func <string, LogEventLevel, bool> filter,
                         LogEventSendMode sendMode, RenderingConfiguration renderingOptions, ILogPayloadSender logPayloadSender)
     : base(sourceType, minimumLevel, loggerStateNamespace, filter, sendMode, renderingOptions, logPayloadSender)
 {
 }