예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            var sb = new StringBuilder();

            sb.AppendLine($"AUDIT LOG:");
            sb.AppendLine($"- {"User",-20}: {CurrentUser} ");
            sb.AppendLine($"- {"ExecutionDuration",-20}: {ExecutionDuration}");

            if (ExtraProperties.Any())
            {
                foreach (var property in ExtraProperties)
                {
                    sb.AppendLine($"- {property.Key,-20}: {property.Value}");
                }
            }
            if (Actions.Any())
            {
                sb.AppendLine("- Actions:");
                foreach (var action in Actions)
                {
                    sb.AppendLine(action.ToString());
                }
            }

            if (Exceptions.Any())
            {
                sb.AppendLine("- Exceptions:");
                foreach (var exception in Exceptions)
                {
                    sb.AppendLine($"  - {exception.Message}");
                    sb.AppendLine($"    {exception}");
                }
            }
            return(sb.ToString());
        }