////////////////////////////////////////////////////////////////////////// public SpriteOptimizer(string projectFile, ILogConsumer logConsumer) { ProjectFile = projectFile; LogConsumer = logConsumer; LogConsumer.ClearLog(); TotalSavedPixels = 0; }
public LogConsumerInfo( ILogConsumer consumer, LogLevel minLevel = LogLevel.Trace, bool logSectionFinish = true) { Consumer = consumer; LogSectionFinish = logSectionFinish; MinLevel = minLevel; }
public ILogReader Create(Stream data, ILogConsumer consumer) { byte[] guidBuffer = new byte[16]; data.Read(guidBuffer, 0, guidBuffer.Length); if (new Guid(guidBuffer) != ExpendableListWriter.ID) { throw new CorruptedDataException(); } return new ExpendableListLogReader(consumer, new ExpendableListReader(data)); }
public void RemoveConsumer(ILogConsumer consumer) { try { _semaphoreSlim.Wait(); _consumers.Remove(consumer); } finally { _semaphoreSlim.Release(); } }
public ExpendableListLogReader(ILogConsumer consumer,IListReader listWriter) { m_listWriter = listWriter; m_consumer = consumer; BinaryPackageDefinitionToGenericUnpackageDefinition packageDefinitionToGenericUnpackageDefinition = new BinaryPackageDefinitionToGenericUnpackageDefinition(); m_dataUnpacker.AddPackageDefinition(packageDefinitionToGenericUnpackageDefinition); m_dataUnpacker.AddPackageDefinition(new GenericPropertyUnpackageDefinition()); m_dataUnpacker.AddPackageDefinition(new ConstGenericPropertyUnpackageDefinition()); var cacheStringUnpackageDefinition = new CacheStringUnpackageDefinition(); m_dataUnpacker.AddPackageDefinition(cacheStringUnpackageDefinition); packageDefinitionToGenericUnpackageDefinition.PackageDefinitionRegistred += OnPackageDefinitionRegistred; cacheStringUnpackageDefinition.CacheStringDeserializer += OnCacheStringDeserializer; }
public ILogReader GetLogReader(Stream data,ILogConsumer logConsumer,Stream otherData = null) { data.Position = 0; byte[] guidBuffer = new byte[16]; data.Read(guidBuffer, 0, guidBuffer.Length); ILogReaderFactory logreader; if (!m_logReaderFactories.TryGetValue(new Guid(guidBuffer), out logreader)) { throw new UnkownLogFileException(); } else { return logreader.Create(data, logConsumer); } }
public void AddConsumer(ILogConsumer consumer) { try { _semaphoreSlim.Wait(); if (!_consumers.Contains(consumer)) { _logger.LogInformation("Add new consumer: {consumer}", consumer); _consumers.Add(consumer); } } finally { _semaphoreSlim.Release(); } }
/// <summary> /// Use the specified consumer for logging. /// </summary> /// <param name="consumer">The log consumer.</param> /// <param name="minLevel">The minimum level of the log message.</param> /// <param name="logSectionFinish">If set to <see langword="true"/> logs the section finish messages with elapsed time span.</param> /// <returns> /// The same <see cref="LogManager" /> instance. /// </returns> public LogManager Use(ILogConsumer consumer, LogLevel minLevel = LogLevel.Trace, bool logSectionFinish = true) { consumer.CheckNotNull(nameof(consumer)); return(Use(new LogConsumerInfo(consumer, minLevel, logSectionFinish))); }
/// <summary> /// Adds the log consumer. /// </summary> /// <param name="typeNameOrAlias">The type name or alias of the log consumer.</param> /// <returns>The <see cref="AtataContextBuilder{TLogConsumer}"/> instance.</returns> public AtataContextBuilder <ILogConsumer> AddLogConsumer(string typeNameOrAlias) { ILogConsumer consumer = LogConsumerAliases.Resolve(typeNameOrAlias); return(AddLogConsumer(consumer)); }
/// <summary> /// Use the specified consumer for logging. /// </summary> /// <param name="consumer">The log consumer.</param> /// <param name="minLevel">The minimum level of the log message.</param> /// <param name="logSectionFinish">If set to <c>true</c> logs the section finish messages with elapsed time span.</param> /// <returns> /// The same <see cref="LogManager" /> instance. /// </returns> public LogManager Use(ILogConsumer consumer, LogLevel minLevel = LogLevel.Trace, bool logSectionFinish = true) { consumer.CheckNotNull(nameof(consumer)); return Use(new LogConsumerInfo(consumer, minLevel, logSectionFinish)); }
public ZKConnection(string address, TimeSpan sessionTimeout, ILogConsumer logger) { this._address = address; this._sessionTimeout = sessionTimeout; this._logWriter = logger; }
public LogConsumerInfo(ILogConsumer consumer, LogLevel minLevel = LogLevel.Trace, bool logSectionFinish = true) { Consumer = consumer; LogSectionFinish = logSectionFinish; MinLevel = minLevel; }