Exemple #1
0
        public LogLevel GetLogLevel()
        {
            var           logger       = ServiceRegistration.Get <ILogger>();
            ILoggerConfig loggerConfig = logger as ILoggerConfig;

            return(loggerConfig != null?loggerConfig.GetLogLevel() : LogLevel.Information);
        }
        public void SetLogLevel(LogLevel level)
        {
            ILoggerConfig loggerConfig = _logger as ILoggerConfig;

            if (loggerConfig != null)
            {
                loggerConfig.SetLogLevel(level);
            }
        }
Exemple #3
0
        public void SetLogLevel(LogLevel level)
        {
            var           logger       = ServiceRegistration.Get <ILogger>();
            ILoggerConfig loggerConfig = logger as ILoggerConfig;

            if (loggerConfig != null)
            {
                loggerConfig.SetLogLevel(level);
            }
        }
        public MineCoreConsole(ILoggerConfig config)
        {
            config.ThrownOnArgNull(nameof(config));

            System.Console.Title           = StringManager.GetString("minecore.app.name");
            System.Console.CancelKeyPress += Console_CancelKeyPress;

            NLogConfigBuilder builder = new NLogConfigBuilder();

            LogManager.Configuration      = builder.GetConfiguration(config);
            builder.ConsoleTarget.Console = this;
        }
Exemple #5
0
        public LoggingConfiguration GetConfiguration(ILoggerConfig config)
        {
            config.ThrownOnArgNull(nameof(config));

            LoggingConfiguration conf = new LoggingConfiguration();

            ConsoleTarget = new MineCoreConsoleTarget()
            {
                Layout = new SimpleLayout("[${longdate}] [${threadname} /${uppercase:${level:padding=5}}] ${message}")
            };

            conf.AddTarget("console", ConsoleTarget);
            conf.AddRule(LogLevel.FromString(config.MinLogLevel.ToString()),
                         LogLevel.FromString(config.MaxLogLevel.ToString()), "console");

            return(conf);
        }
        /// <summary>
        /// Set Log Level
        /// </summary>
        /// <param name="level">desired log level</param>
        internal static void SetLogLevel(LogLevel level)
        {
            ILoggerConfig config = ServiceRegistration.Get <ILoggerConfig>();

            if (config != null)
            {
                config.SetLogLevel(level);
            }

            IServerSettingsClient serverSettings = ServiceRegistration.Get <IServerSettingsClient>(false);

            if (serverSettings != null)
            {
                // Forward the local settings to server
                LogSettings settings = ServiceRegistration.Get <ISettingsManager>().Load <LogSettings>();
                serverSettings.Save(settings);
            }
        }
        public LogLevel GetLogLevel()
        {
            ILoggerConfig loggerConfig = _logger as ILoggerConfig;

            return(loggerConfig != null?loggerConfig.GetLogLevel() : LogLevel.Information);
        }
 public ILoggerConnection NewConnection(ILoggerConfig loggerConfig)
 {
     return(new SeriLogConnection(loggerConfig));
 }
Exemple #9
0
 public Logger(ILoggerConfig config)
 {
     Config = config;
 }
Exemple #10
0
 public Logger()
 {
     Config = new LoggerConfig();
 }
        /// <summary>
        /// Retrieve log level
        /// </summary>
        /// <returns></returns>
        internal static LogLevel GetLogLevel()
        {
            ILoggerConfig config = ServiceRegistration.Get <ILoggerConfig>();

            return(config != null?config.GetLogLevel() : LogLevel.Information);
        }
Exemple #12
0
        public SeriLogConnection(ILoggerConfig loggerConfig)
        {
            var serilogConfig = loggerConfig as ISeriLogConfig;

            _logger = serilogConfig.Logger;
        }
Exemple #13
0
 public void StartConsuming(ILoggerConfig config, IConsumer consumer)
 {
     throw new NotSupportedException("SeriLog not supported in this mode");
 }
Exemple #14
0
 public Logger(string fileName, ILoggerConfig config)
 {
     this.config      = config;
     this.fileWritter = new ConcurrentFileWritter(fileName, fileName, this.config.LogBufferSize, this.config.LogBufferCount);
 }