ToString() public méthode

public ToString ( ) : string
Résultat string
Exemple #1
0
        /// <summary>
        ///   Write the log entry to the output destination.
        /// </summary>
        /// <param name="message"> Must not be null or empty </param>
        /// <param name="logLevel"> </param>
        /// <param name="category"> </param>
        /// <returns> </returns>
        public virtual LogEntry Log(string message, LogLevel logLevel = LogLevel.Verbose, string category = null)
        {
            if (string.IsNullOrWhiteSpace(message))
            {
                throw new ArgumentNullException("message");
            }

            var logEntry = new LogEntry
            {
                Timestamp = DateTime.UtcNow,
                Message = message,
                LogLevel = logLevel,
                Category = category,
            };

            if (LogAction != null && logLevel != LogLevel.None && logLevel >= LogLevel)
            {
                // if Formatter is null, generates a default formatted string
                var output = logEntry.ToString(Formatter);

                LogAction(output);
            }

            return logEntry;
        }