コード例 #1
0
ファイル: LogMessage.cs プロジェクト: lanicon/HawkEye
 public LogMessage(LoggingSection loggingSection, LogLevel logLevel, string message, DateTime timestamp)
 {
     LoggingSection = loggingSection;
     LogLevel       = logLevel;
     Message        = message;
     Timestamp      = timestamp;
 }
コード例 #2
0
ファイル: LogMessage.cs プロジェクト: Kitt3120/HawkEye
        /// <summary>
        /// Constructs a LogMessage.
        /// Not intended for manual usage. Instead, use LoggingSection.CreateLogMessage();
        /// </summary>
        /// <param name="loggingSection">The LoggingSection the LogMessage belongs to.</param>
        /// <param name="logLevel">The LogLevel to be used for the LogMessage.</param>
        /// <param name="message">The message content to be used for the LogMessage.</param>
        internal LogMessage(LoggingSection loggingSection, LogLevel logLevel, string message)
        {
            if (loggingSection == null)
            {
                throw new ArgumentNullException("loggingSection mustn't be null.");
            }

            LoggingSection = loggingSection;
            LogLevel       = logLevel;
            Message        = message;
            Timestamp      = DateTime.Now;
        }
コード例 #3
0
ファイル: LoggingSection.cs プロジェクト: lanicon/HawkEye
        public LoggingSection(string name, LoggingSection parent = null)
        {
            Name = name;

            Parent = parent;
            if (parent != null)
            {
                parent.Children.Add(this);
            }

            Children = new List <LoggingSection>();
            Messages = new List <LogMessage>();

            Disposed = false;
        }
コード例 #4
0
        /// <summary>
        /// Constructs a LoggingSection.
        /// </summary>
        /// <param name="name">Name of the LoggingSection</param>
        /// <param name="parent">Parent LoggingSection</param>
        public LoggingSection(string name, LoggingSection parent = null)
        {
            Name = name;

            if (parent != null)
            {
                lock (parent.childrenLock)
                {
                    Parent = parent;
                    parent.children.Add(this);
                }
            }

            children    = new List <LoggingSection>();
            logMessages = new List <LogMessage>();

            childrenLock    = new object();
            logMessagesLock = new object();

            Disposed = false;
        }
コード例 #5
0
 /// <summary>
 /// Constructs a LoggingSection.
 /// </summary>
 /// <param name="obj">Object that should provide the name of the LoggingSection</param>
 /// <param name="parent">Parent LoggingSection</param>
 public LoggingSection(object obj, LoggingSection parent = null) : this(obj.GetType().Name + (obj.GetType().GenericTypeArguments.Length > 0 ? $"<{string.Join(", ", obj.GetType().GenericTypeArguments.Select(type => type.Name))}>" : ""), parent)
 {
 }