/// <summary> /// Marks the specified <see cref="IPromise"/> as success. If the /// <see cref="IPromise"/> is done already, logs a message. /// </summary> /// <param name="promise">The <see cref="IPromise"/> to complete.</param> /// <param name="logger">The <see cref="IInternalLogger"/> to use to log a failure message.</param> public static void SafeSetSuccess(IPromise promise, IInternalLogger logger) { if (!promise.IsVoid && !promise.TryComplete() && logger is object) { logger.FailedToMarkAPromiseAsSuccess(promise); } }
static ByteBufferUtil() { Logger = InternalLoggerFactory.GetInstance(typeof(ByteBufferUtil)); string allocType = SystemPropertyUtil.Get("io.netty.allocator.type", "pooled"); allocType = allocType.Trim(); IByteBufferAllocator alloc; if ("unpooled".Equals(allocType, StringComparison.OrdinalIgnoreCase)) { alloc = UnpooledByteBufferAllocator.Default; Logger.Debug("-Dio.netty.allocator.type: {}", allocType); } else if ("pooled".Equals(allocType, StringComparison.OrdinalIgnoreCase)) { alloc = PooledByteBufferAllocator.Default; Logger.Debug("-Dio.netty.allocator.type: {}", allocType); } else if ("arraypooled".Equals(allocType, StringComparison.OrdinalIgnoreCase)) { alloc = ArrayPooledByteBufferAllocator.Default; Logger.Debug("-Dio.netty.allocator.type: {}", allocType); } else { alloc = PooledByteBufferAllocator.Default; Logger.Debug("-Dio.netty.allocator.type: pooled (unknown: {})", allocType); } DefaultAllocator = alloc; MaxBytesPerCharUtf8 = Encoding.UTF8.GetMaxByteCount(1); AsciiByteProcessor = new FindNonAscii(); }
/// <summary> /// Marks the specified {@code promise} as failure. If the {@code promise} is done already, log a message. /// </summary> public static void SafeSetFailure(TaskCompletionSource promise, Exception cause, IInternalLogger logger) { if (promise != TaskCompletionSource.Void && !promise.TrySetException(cause)) { logger.Warn(string.Format("Failed to mark a promise as failure because it's done already: {0}", promise), cause); } }
private void CheckLoggerCreated() { if (_inner == null) { _inner = CreateLogger(LogLevel.Detailed, LogDestination.Console, string.Empty); } }
/// <summary> /// Try to mark the <see cref="IPromise"/> as failure and log if <paramref name="logger"/> is not <c>null</c> in case this fails. /// </summary> /// <param name="p"></param> /// <param name="cause"></param> /// <param name="logger"></param> public static void TryFailure(IPromise p, Exception cause, IInternalLogger logger) { if (!p.TrySetException(cause) && logger is object) { logger.FailedToMarkAPromiseAsFailure(p, cause); } }
public MetadataUtils(Config.Saml2Configuration configuration, Logging.IInternalLogger logger) { if (configuration == null) throw new ArgumentNullException("configuration"); if (logger == null) throw new ArgumentNullException("logger"); this.configuration = configuration; this.logger = logger; }
public Logout(IInternalLogger logger, SAML2.Config.Saml2Configuration config) { if (logger == null) throw new ArgumentNullException("logger"); if (config == null) throw new ArgumentNullException("config"); this.logger = logger; this.config = config; }
/// <summary> /// Marks the specified <see cref="IPromise"/> as failure. If the /// <see cref="IPromise"/> is done already, log a message. /// </summary> /// <param name="promise">The <see cref="IPromise"/> to complete.</param> /// <param name="cause">The <see cref="Exception"/> to fail the <see cref="IPromise"/> with.</param> /// <param name="logger">The <see cref="IInternalLogger"/> to use to log a failure message.</param> public static void SafeSetFailure(IPromise promise, Exception cause, IInternalLogger logger) { if (!promise.IsVoid && !promise.TrySetException(cause) && logger is object) { logger.FailedToMarkAPromiseAsFailure(promise, cause); } }
/// <summary> /// Try to cancel the <see cref="IPromise"/> and log if <paramref name="logger"/> is not <c>null</c> in case this fails. /// </summary> /// <param name="p"></param> /// <param name="logger"></param> public static void TryCancel(IPromise p, IInternalLogger logger) { if (!p.TrySetCanceled() && logger is object) { logger.FailedToMarkAPromiseAsCancel(p); } }
/// <summary> /// Try to mark the <see cref="IPromise"/> as success and log if <paramref name="logger"/> is not <c>null</c> in case this fails. /// </summary> /// <param name="p"></param> /// <param name="logger"></param> public static void TrySuccess(IPromise p, IInternalLogger logger) { if (!p.TryComplete() && logger is object) { logger.FailedToMarkAPromiseAsSuccess(p); } }
public static void IgnoringFrameForStreamRst(this IInternalLogger logger, IChannelHandlerContext ctx, Http2FrameTypes frameName, bool isResetSent, int lastStreamKnownByPeer) { logger.Info("{} ignoring {} frame for stream {}", ctx.Channel, frameName, isResetSent ? "RST_STREAM sent." : ("Stream created after GOAWAY sent. Last known stream by peer " + lastStreamKnownByPeer)); }
/// <summary> /// Marks the specified {@code promise} as success. If the {@code promise} is done already, log a message. /// </summary> public static void SafeSetSuccess(TaskCompletionSource promise, IInternalLogger logger) { if (promise != TaskCompletionSource.Void && !promise.TryComplete()) { logger.Warn(string.Format("Failed to mark a promise as success because it is done already: {0}", promise)); } }
/// <summary> /// Marks the specified <see cref="TaskCompletionSource"/> as success. If the /// <see cref="TaskCompletionSource"/> is done already, logs a message. /// </summary> /// <param name="promise">The <see cref="TaskCompletionSource"/> to complete.</param> /// <param name="logger">The <see cref="IInternalLogger"/> to use to log a failure message.</param> public static void SafeSetSuccess(TaskCompletionSource promise, IInternalLogger logger) { if (promise != TaskCompletionSource.Void && !promise.TryComplete()) { logger.Warn($"Failed to mark a promise as success because it is done already: {promise}"); } }
public NLPImportHandler( IBlipClientFactory blipClientFactory, IInternalLogger logger) : base(logger) { _settingsFile = new SettingsFile(); _blipClientFactory = blipClientFactory; }
/// <summary> /// Initializes the <see cref="SysCacheProvider"/> class. /// </summary> static SysCacheProvider() { Log = LoggerProvider.LoggerFor(typeof(SysCacheProvider)); // We need to determine which cache regions are configured in the configuration file, but we cant create the // cache regions at this time because there could be nhibernate configuration values // that we need for the cache regions such as connection info to be used for data dependencies. But this info // isn't available until build cache is called. So allocate space but only create them on demand. var configSection = SysCacheSection.GetSection(); if (configSection != null && configSection.CacheRegions.Count > 0) { CacheRegionSettings = new Dictionary <string, CacheRegionElement>(configSection.CacheRegions.Count); foreach (var cacheRegion in configSection.CacheRegions) { if (cacheRegion is CacheRegionElement element) { CacheRegionSettings.Add(element.Name, element); } } } else { CacheRegionSettings = new Dictionary <string, CacheRegionElement>(0); Log.Info( "No cache regions specified. Cache regions can be specified in sysCache configuration section with custom settings."); } }
public void WarningTest1() { IInternalLogger target = CreateLogger(); target.SetLevel(LogLevel.Always); calls = 0; target.Warning(message, id); Assert.AreEqual(calls, 0); calls = 0; target.SetLevel(LogLevel.All); target.Warning(message, ids, ex); Assert.AreEqual(calls, 1); Assert.AreEqual(lastItem.Category, category); Assert.AreEqual(lastItem.Level, LogLevel.Warning); Assert.IsNotNull(lastItem.Ex); Assert.AreEqual(lastItem.Ex, ex); Assert.AreEqual(lastItem.Message, message); Assert.IsNotNull(lastItem.Ids); Assert.AreEqual(ids, lastItem.Ids); calls = 0; target.SetLevel(LogLevel.Warning); target.Warning(message, id); Assert.AreEqual(calls, 1); }
static MemCacheProvider() { log = LoggerProvider.LoggerFor((typeof(MemCacheProvider))); var configs = ConfigurationManager.GetSection("memcache") as MemCacheConfig[]; if (configs != null) { var myWeights = new ArrayList(); var myServers = new ArrayList(); foreach (MemCacheConfig config in configs) { myServers.Add(string.Format("{0}:{1}", config.Host, config.Port)); if (log.IsDebugEnabled) { log.DebugFormat("adding config for memcached on host {0}", config.Host); } if (config.Weight > 0) { myWeights.Add(config.Weight); } } servers = (string[])myServers.ToArray(typeof(string)); weights = (int[])myWeights.ToArray(typeof(int)); } }
public static void BuggyImplementation(this IInternalLogger logger, SingleThreadEventExecutor eventExecutor) { var type = eventExecutor.GetType(); logger.Error( $"Buggy {type.Name} implementation; {type.Name}.ConfirmShutdown() must be called " + "before run() implementation terminates."); }
public IdpSelectionUtil(IInternalLogger logger) { if (logger == null) { throw new ArgumentNullException("logger"); } this.logger = logger; }
/// <summary> /// Creates a new instance with the specified logger name. /// </summary> /// <param name="name">the name of the class to use for the logger</param> /// <param name="level">the log level</param> public XmppLoggingHandler(string name, LogLevel level) { Contract.Requires <ArgumentNullException>(name != null, $"{nameof(name)} cannot be null"); Logger = InternalLoggerFactory.GetInstance(name); Level = level; InternalLevel = level.ToInternalLevel(); }
public AsyncQueueDispatcher(IPayloadSender payloadSender, IInternalLogger logger = null) { _payloadSender = payloadSender ?? throw new ArgumentNullException(nameof(payloadSender)); _logger = logger; _queue = new ConcurrentQueue <IPayload>(); _cancellationTokenSource = new CancellationTokenSource(); _eventSlim = new ManualResetEventSlim(false, spinCount: 1); }
public void Initialise(LogLevel logLevel, string filePath) { var destination = string.IsNullOrWhiteSpace(filePath) ? LogDestination.Console : LogDestination.File; _inner = CreateLogger(logLevel, destination, filePath); }
public BulkSender(IWebClientFactory webClientFactory, IInternalLogger internalLogger) { _webClientFactory = webClientFactory; _internalLogger = internalLogger; _jsonSerializer = new JsonSerializer { ContractResolver = new CamelCasePropertyNamesContractResolver() }; }
public static void Log(this IInternalLogger logger, string message) { #if !NET45 logger.Log(null, message, Array.Empty <object>()); #else logger.Log(null, message); #endif }
public LogzioTarget() { var bootstraper = new Bootstraper(); bootstraper.Bootstrap(); _shipper = bootstraper.Resolve <IShipper>(); _internalLogger = bootstraper.Resolve <IInternalLogger>(); }
private Http2FrameLogger(InternalLogLevel level, IInternalLogger logger) { if (logger is null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.logger); } _level = level; _logger = logger; }
static EmbeddedChannel() { LOCAL_ADDRESS = new EmbeddedSocketAddress(); REMOTE_ADDRESS = new EmbeddedSocketAddress(); EMPTY_HANDLERS = EmptyArray <IChannelHandler> .Instance; s_logger = InternalLoggerFactory.GetInstance <EmbeddedChannel>(); METADATA_NO_DISCONNECT = new ChannelMetadata(false); METADATA_DISCONNECT = new ChannelMetadata(true); }
public NLPAnalyseService( IBlipClientFactory blipClientFactory, IFileManagerService fileService, IInternalLogger logger) { _blipClientFactory = blipClientFactory; _fileService = fileService; _logger = logger; }
public void ShouldGetInstance() { IInternalLogger one = InternalLoggerFactory.GetInstance("helloWorld"); IInternalLogger two = InternalLoggerFactory.GetInstance <string>(); Assert.NotNull(one); Assert.NotNull(two); Assert.NotSame(one, two); }
static RedisProvider() { Log = LoggerProvider.LoggerFor(typeof (RedisProvider)); Config = ConfigurationManager.GetSection("redis") as RedisConfig; if (Config == null) { Log.Info("redis configuration section not found, using default configuration (127.0.0.1:6379)."); Config = new RedisConfig("localhost",6379); } }
public ClosedStateSpecs(ITestOutputHelper output) : base(output) { var sink = new TestLoggerSink(); _logger = InternalLogger.Create(Defaults.DefaultLogLevel, sink); var context = new FakeConnectionContext(); _state = new ConnectionClosedState(context, _logger); }
/// <exception cref="ArgumentException">Thrown when <paramref name="configuration"/> is null</exception> public CastleClient(CastleConfiguration configuration) { ArgumentGuard.NotNull(configuration, nameof(configuration)); _configuration = configuration; _logger = new LoggerWithLevels(configuration.Logger, configuration.LogLevel); _messageSender = MessageSenderFactory.Create(configuration, _logger); }
public OutputEngine( ISettingReaderFactory settingReaderFactory, IFilePathGetterFactory filePathGetterFactory, IMessageTextFormatter messageTextFormatter, IInternalLogger internalLogger) { _settingReaderFactory = settingReaderFactory; _filePathGetterFactory = filePathGetterFactory; _messageTextFormatter = messageTextFormatter; _internalLogger = internalLogger; }
/// <summary> /// Creates a new instance with the specified logger name. /// </summary> /// <param name="name">the name of the class to use for the logger</param> /// <param name="level">the log level</param> public LoggingHandler(string name, LogLevel level) { if (name == null) { throw new NullReferenceException("name"); } this.Logger = InternalLoggerFactory.GetInstance(name); this.Level = level; this.InternalLevel = level.ToInternalLevel(); }
/// <summary> /// Creates a new instance with the specified logger name. /// </summary> /// <param name="type">the class type to generate the logger for</param> /// <param name="level">the log level</param> public LoggingHandler(Type type, LogLevel level) { if (type == null) { throw new NullReferenceException("type"); } this.Logger = InternalLoggerFactory.GetInstance(type); this.Level = level; this.InternalLevel = level.ToInternalLevel(); }
static CouchbaseCacheProvider() { log = LoggerProvider.LoggerFor(typeof (CouchbaseCacheProvider)); config = ConfigurationManager.GetSection("couchbase") as ICouchbaseClientConfiguration; if (config == null) { log.Info("couchbase configuration section not found, using default configuration (127.0.0.1:8091)."); config = new CouchbaseClientConfiguration(); config.Urls.Add(new UriBuilder("http://", IPAddress.Loopback.ToString(),8091, "pools").Uri); } }
/// <summary> /// Creates a new instance with the specified logger name. /// </summary> /// <param name="type">the class type to generate the logger for</param> /// <param name="level">the log level</param> public LoggingHandler(Type type, LogLevel level) { if (type == null) { throw new NullReferenceException("type"); } this.Logger = InternalLoggerFactory.GetInstance(type); this.Level = level; this.InternalLevel = level.ToInternalLevel(); }
static MemCacheProvider() { log = LoggerProvider.LoggerFor(typeof (MemCacheProvider)); config = ConfigurationManager.GetSection("enyim.com/memcached") as IMemcachedClientConfiguration; if (config == null) { log.Info("enyim.com/memcached configuration section not found, using default configuration (127.0.0.1:11211)."); config = new MemcachedClientConfiguration(); config.Servers.Add(new IPEndPoint(IPAddress.Loopback, 11211)); } }
static MemCacheProvider() { log = LoggerProvider.LoggerFor(typeof(MemCacheProvider)); config = ConfigurationManager.GetSection("enyim.com/memcached") as IMemcachedClientConfiguration; if (config == null) { log.Info("enyim.com/memcached configuration section not found, using default configuration (127.0.0.1:11211)."); config = new MemcachedClientConfiguration(); config.Servers.Add(new IPEndPoint(IPAddress.Loopback, 11211)); } }
static RedisCacheProvider() { log = LoggerProvider.LoggerFor(typeof(RedisCacheProvider)); config = ConfigurationManager.GetSection("nhibernateRedisCache") as RedisCacheProviderSection; if (config == null) { config = new RedisCacheProviderSection(); } }
public static void LogMapped(this Mapping.Property property, IInternalLogger log) { if (log.IsDebugEnabled) { string msg = "Mapped property: " + property.Name; string columns = string.Join(",", property.Value.ColumnIterator.Select(c => c.Text).ToArray()); if (columns.Length > 0) msg += " -> " + columns; if (property.Type != null) msg += ", type: " + property.Type.Name; log.Debug(msg); } }
static MemoryCacheProvider() { log = LoggerProvider.LoggerFor(typeof(MemoryCacheProvider)); caches = new Dictionary<string, ICache>(); var list = ConfigurationManager.GetSection("memorycache") as CacheConfig[]; if (list != null) { foreach (CacheConfig cache in list) { caches.Add(cache.Region, new MemoryCache(cache.Region, cache.Properties)); } } }
public OutputEngine(ISettingReaderFactory settingReaderFactory, IXmlSettingsProviderFactory xmlSettingsProviderFactory, IMessageTextFormatter messageTextFormatter, IInternalLogger internalLogger) { _settingReaderFactory = settingReaderFactory; _xmlSettingsProviderFactory = xmlSettingsProviderFactory; _messageTextFormatter = messageTextFormatter; _internalLogger = internalLogger; _levelColors = new Dictionary<Level, ConsoleColor>(); foreach (var level in Enum.GetValues(typeof(Level))) { _levelColors.Add((Level)level, ConsoleColor.Gray); } }
static MemCacheProvider() { log = LoggerProvider.LoggerFor((typeof(MemCacheProvider))); var configs = ConfigurationManager.GetSection("memcache") as MemCacheConfig[]; if (configs != null) { var myWeights = new ArrayList(); var myServers = new ArrayList(); foreach (MemCacheConfig config in configs) { myServers.Add(string.Format("{0}:{1}", config.Host, config.Port)); if (log.IsDebugEnabled) { log.DebugFormat("adding config for memcached on host {0}", config.Host); } if (config.Weight > 0) { myWeights.Add(config.Weight); } } servers = (string[]) myServers.ToArray(typeof (string)); weights = (int[]) myWeights.ToArray(typeof (int)); } }
static SharedCacheProvider() { log = LoggerProvider.LoggerFor((typeof(SharedCacheProvider))); var configs = ConfigurationManager.GetSection("sharedcache") as SharedCacheConfig[]; }
public SamlMetadataWriter(Saml2Configuration configuration) { this.configuration = configuration; logger = LoggerProvider.LoggerFor(typeof(Saml2Configuration)); }
internal InitializationContext(IEnumerable<Assembly> assemblies, IInternalLogger internalLogger) { _formatPatternFactory = new FormatPatternFactory(new FormatRendererTypeMap(assemblies)); _conditionFactory = new ConditionFactory(assemblies); _internalLogger = internalLogger; }
/// <summary></summary> static SessionFactoryObjectFactory() { log = LoggerProvider.LoggerFor(typeof(SessionFactoryObjectFactory)); log.Debug("initializing class SessionFactoryObjectFactory"); }
static VelocityProvider() { log = LoggerProvider.LoggerFor((typeof(VelocityProvider))); var configs = ConfigurationManager.GetSection("velocity") as VelocityConfig[]; }
static MemCacheClient() { log = LoggerProvider.LoggerFor((typeof(MemCacheClient))); }
private void Dispose(bool disposing) { if (disposing) { if (!_disposed) { _disposed = true; _internalLogger = null; } } }
static ElasticacheClient() { Log = LoggerProvider.LoggerFor(typeof(ElasticacheClient)); Hasher = HashAlgorithm.Create(); Md5 = MD5.Create(); }
internal virtual void PerformInitialization(InitializationContext context) { // Get the internal logger. _internalLogger = context.InternalLogger; // Initalize all filters. this.Filters.Initialize(context); // Perform custom initialization for this sink. this.Initialize(context); // We're now properly initialized. _isInitialized = true; }
/// <summary> /// Construct an instance of the trace listener /// </summary> /// <param name="name">The name of the trace listener</param> protected CustomTraceListener(string name) : base(name) { InternalLogger = DefaultServiceLocator.GetService<IInternalLogger>(); }
static VelocityClient() { log = LoggerProvider.LoggerFor(typeof(VelocityClient)); }
static SharedCacheClient() { log = LoggerProvider.LoggerFor(typeof(SharedCacheClient)); }
public TmpIdTableDropIsolatedWork(IQueryable persister, IInternalLogger log, ISessionImplementor session) { this.persister = persister; this.log = log; this.session = session; }
protected AbstractStatementExecutor(IStatement statement, IInternalLogger log) { Statement = statement; Walker = statement.Walker; this.log = log; }
/// <summary> /// Creates a new instance with the specified logger name. /// </summary> /// <param name="name">the name of the class to use for the logger</param> /// <param name="level">the log level</param> public LoggingHandler(string name, LogLevel level) { if (name == null) { throw new NullReferenceException("name"); } this.Logger = InternalLoggerFactory.GetInstance(name); this.Level = level; this.InternalLevel = level.ToInternalLevel(); }
/// <summary> /// Releases unmanaged and - optionally - managed resources /// </summary> /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> protected virtual void Dispose(bool disposing) { if (disposing) { if (!_disposed) { _disposed = true; _internalLogger = null; } } }