示例#1
0
        private static ILogBuilder CreateBuilder(LogLevel logLevel, string callerFilePath)
        {
            string name = GetName(callerFilePath);

            var writer  = ResolveWriter();
            var builder = new LogBuilder(logLevel, writer);

            builder.Logger(name);

            MergeProperties(builder);

            return(builder);
        }
示例#2
0
        private static LogBuilder CreateBuilder(LogLevel logLevel, string callerFilePath)
        {
            string name = LoggerExtensions.GetFileNameWithoutExtension(callerFilePath ?? string.Empty);

            var writer  = ResolveWriter();
            var builder = new LogBuilder(logLevel, writer);

            builder.Logger(name);

            MergeProperties(builder);

            return(builder);
        }
示例#3
0
        private static void MergeProperties(LogBuilder builder)
        {
            // copy global properties to current builder only if it has been created
            if (_globalProperties.IsValueCreated)
            {
                foreach (var pair in _globalProperties.Value)
                {
                    builder.Property(pair.Key, pair.Value);
                }
            }

            // copy thread-local properties to current builder only if it has been created
            if (_threadProperties.IsValueCreated)
            {
                foreach (var pair in _threadProperties.Value)
                {
                    builder.Property(pair.Key, pair.Value);
                }
            }
        }