예제 #1
0
        /// <summary>
        /// Searches for the reflected property and returns its value as a string
        /// </summary>
        public override string FormatToken(string tokenTemplate, LogEntity log)
        {
            Type         logType  = log.GetType();
            PropertyInfo property = logType.GetProperty(tokenTemplate);

            if (property != null)
            {
                object value = property.GetValue(log, null);
                return(value != null?value.ToString() : string.Empty);
            }
            else
            {
                return(String.Format(Resource.Culture, Resource.ReflectedPropertyTokenNotFound, tokenTemplate));
            }
        }