private void LogConverterCompilation(MutatorsContext context, Stopwatch sw)
        {
            var converterCollectionTypeName = GetType().Name;
            var message = new StringBuilder($"{converterCollectionTypeName} was compiled in {sw.ElapsedMilliseconds} ms\n");

            message.AppendLine("Context:\n");
            var mutatorsContextTypeName = context.GetType().Name;

            foreach (var propertyInfo in context.GetType().GetProperties())
            {
                message.AppendLine($"\t{mutatorsContextTypeName}.{propertyInfo.Name}: {propertyInfo.GetValue(context)}");
            }
            logger.Info(message.ToString());
        }
Пример #2
0
        private void LogConverterCompilation(MutatorsContext context, Stopwatch sw)
        {
            var logProperties = new Dictionary <string, object>
            {
                { "ConverterCollectionName", GetType().Name },
                { "CompilationTimeMilliseconds", sw.ElapsedMilliseconds }
            };
            var mutatorsContextTypeName = context.GetType().Name;

            foreach (var propertyInfo in context.GetType().GetProperties())
            {
                logProperties.Add($"{mutatorsContextTypeName}.{propertyInfo.Name}", propertyInfo.GetValue(context));
            }
            logger.Log(new LogEvent(LogLevel.Info, DateTimeOffset.UtcNow, "{ConverterCollectionName} was compiled in {CompilationTimeMilliseconds} ms", logProperties));
        }