public FoundationLogFactory(bool forInternalUse)
        {
            var logWriter = new LogWriter(new TextLogWriter(TraceWriter.Instance), LogLevel.Debug);

            _dateTimeProvider = LocalTime.Default;
            _multipeLog       = new MultipleLog(logWriter.ItemAsEnumerable());
        }
Exemple #2
0
    public LogFactory(bool forInternalUse)
    {
        var logWriter = new LogWriter(new TextLogWriter(TraceWriter.Instance, new TextLogFormatter()), LogLevel.Debug);

        _dateTimeProvider = LocalTime.Default;
        _multipeLog       = new MultipleLog(logWriter.ItemToArray());
    }
        public FoundationLogFactory()
        {
            var logWriters = new List <LogWriter>();
            var node       = Settings.CurrentType;

            node.Attributes.TryGetAttributeValue("DateTimeKind", DateTimeKind.Utc, out var dateTimeKind);
            _dateTimeProvider = dateTimeKind == DateTimeKind.Utc
                ? (IDateTimeProvider)UniversalTime.Default
                : LocalTime.Default;

            var logWritersNode = node.ChildNodes["LogWriters"];

            foreach (var childNode in logWritersNode.ChildNodes)
            {
                var attributes = childNode.Attributes;
                var enabled    = attributes["Enabled"].GetValue <bool>();

                if (enabled)
                {
                    var logWriter = ReadLogWriter(childNode);
                    if (logWriter != null)
                    {
                        logWriters.Add(logWriter);
                    }
                }
            }

            if (logWriters.Count > 0)
            {
                _multipeLog         = new MultipleLog(logWriters);
                LogFactory.Instance = this;

                foreach (var logWriter in logWriters)
                {
                    logWriter.logWriter.Open();
                }
            }
        }