Exemple #1
0
        private void TraceCallAndParamters(IInvocation invocation)
        {
            List <string> args = new List <string>();

            foreach (object arg in invocation.Arguments)
            {
                if (arg == null)
                {
                    args.Add("null");
                    continue;
                }
                XmlSerializer serializer = TryGetSerializer(arg);
                if (serializer == null)
                {
                    args.Add(arg.ToString());
                    continue;
                }
                StringWriter sw = new StringWriter();
                serializer.Serialize(sw, arg);
                args.Add(sw.GetStringBuilder().ToString());
            }

            logger.Trace("{0}({1});", invocation.Method.Name, string.Join(", ", args.ToArray()));
        }