Exemple #1
0
 public void OnComplete()
 {
     if (_injection != null && _injection.IsValid())
     {
         Logger.Info(string.Format("{0} executed in {1} mSec",
                                   _injection.Method.Name, DateTime.Now.Subtract(_startTime).TotalMilliseconds));
     }
 }
Exemple #2
0
        public void OnComplete()
        {
            if (!_injection.IsValid())
            {
                return;
            }

            Logger.Info(_injection.GetMessage("Completed"));
        }
Exemple #3
0
        public void OnComplete()
        {
            if (_injection != null && _injection.IsValid())
            {
                Logger.Info(string.Format("{0} executed in {1} mSec", _injection.Method.Name, DateTime.Now.Subtract(_startTime).TotalMilliseconds));
            }

            _context.Span.AddLog(LogEvent.Message($"OnComplete running at: {DateTime.Now} ,executed in {DateTime.Now.Subtract(_startTime).TotalMilliseconds}"));
            _tracingContext.Release(_context);
        }
Exemple #4
0
        public void OnInvoke(CInjection injection)
        {
            try
            {
                _context = _tracingContext.CreateEntrySegmentContext(injection.Method.Name, new TextCarrierHeaderCollection(new Dictionary <string, string>()));

                _injection = injection;
                _startTime = DateTime.Now;

                if (!Logger.IsDebugEnabled)
                {
                    return;
                }
                if (_injection == null)
                {
                    return;
                }
                if (!File.Exists(FileName))
                {
                    return;
                }
                if (!injection.IsValid())
                {
                    return;
                }

                var objectSearch = CachedSerializer.Deserialize <ObjectSearch>(File.ReadAllText(FileName), Encoding.UTF8);
                if (objectSearch == null || objectSearch.PropertyNames == null)
                {
                    return;
                }

                _context.Span.AddTag("Method", injection.Method.Name);
                foreach (string propertyName in objectSearch.PropertyNames)
                {
                    var dictionary = _injection.GetPropertyValue(propertyName);
                    var method     = "";
                    var value      = "";
                    foreach (var key in dictionary.Keys)
                    {
                        method = string.Format("Method {0} Argument #{1} :{2}= {3}", injection.Method.Name, key, propertyName, dictionary[key] ?? "<null>");
                        Logger.Debug(method);

                        value += propertyName + "=" + dictionary[key] ?? "<null> /r/n ";
                    }

                    _context.Span.AddLog(LogEvent.Event($"{injection.Method.Name} :{value}"));
                }
            }
            catch (Exception ex)
            {
                Logger.Debug("OnInvoke ex:" + ex.Message);
                Logger.Error(ex);
            }
        }
Exemple #5
0
        public void OnInvoke(CInjection injection)
        {
            _injection = injection;


            if (!Logger.IsDebugEnabled)
            {
                return;
            }
            if (_injection == null)
            {
                return;
            }
            if (!File.Exists(FileName))
            {
                return;
            }
            if (!injection.IsValid())
            {
                return;
            }

            var objectSearch = CachedSerializer.Deserialize <ObjectSearch>(File.ReadAllText(FileName), Encoding.UTF8);

            if (objectSearch == null || objectSearch.PropertyNames == null)
            {
                return;
            }

            foreach (string propertyName in objectSearch.PropertyNames)
            {
                var dictionary = _injection.GetPropertyValue(propertyName);

                foreach (var key in dictionary.Keys)
                {
                    Logger.Debug(String.Format("Method {0} Argument #{1} :{2}= {3}", injection.Method.Name, key, propertyName, dictionary[key] ?? "<null>"));
                }
            }
        }
        public void OnInvoke(CInjection injection)
        {
            _injection = injection;

            if (!Logger.IsDebugEnabled) return;
            if (_injection == null) return;
            if (!File.Exists(FileName)) return;
            if (!injection.IsValid()) return;

            var objectSearch = CachedSerializer.Deserialize<ObjectSearch>(File.ReadAllText(FileName), Encoding.UTF8);
            if (objectSearch == null || objectSearch.PropertyNames == null) return;

            foreach (string propertyName in objectSearch.PropertyNames)
            {
                var dictionary = _injection.GetPropertyValue(propertyName);

                foreach (var key in dictionary.Keys)
                {
                    Logger.Debug(String.Format("Method {0} Argument #{1} :{2}= {3}", injection.Method.Name, key, propertyName, dictionary[key] ?? "<null>"));
                }
            }
        }
Exemple #7
0
        public void OnInvoke(CInjection injection)
        {
            if (injection == null)
            {
                return;
            }

            _injection = injection;

            try
            {
                if (injection.IsValid())
                {
                    Logger.Info(_injection.GetMessage("Invoked"));
                }

                if (!Logger.IsDebugEnabled)
                {
                    return;
                }

                var parameters = injection.Method.GetParameters();
                if (injection.Arguments != null)
                {
                    Logger.Debug(String.Format(">> Paramerters: {0}", injection.Arguments.Length));
                    for (int i = 0; i < injection.Arguments.Length; i++)
                    {
                        var currentArgument = injection.Arguments[i];
                        if (currentArgument == null)
                        {
                            Logger.Debug(String.Format("    [{0}]: <null>", parameters[i].Name));
                            continue;
                        }

                        if (currentArgument is IDictionary)
                        {
                            var dictionary        = (IDictionary)currentArgument;
                            var dictionaryBuilder = new StringBuilder();
                            foreach (var key in dictionary.Keys)
                            {
                                dictionaryBuilder.AppendFormat("{0}={1}|", key, GetStringValue(dictionary[key]));
                            }

                            Logger.Debug(String.Format("    [{0}]: {1}", parameters[i].Name, dictionaryBuilder.ToString().TrimEnd(new[] { '|' })));
                        }
                        else if (currentArgument is ICollection)
                        {
                            ICollection   collection        = (ICollection)currentArgument;
                            IEnumerator   enumerator        = collection.GetEnumerator();
                            StringBuilder dictionaryBuilder = new StringBuilder();

                            while (enumerator.MoveNext())
                            {
                                dictionaryBuilder.AppendFormat("{0},", GetStringValue(enumerator.Current)).AppendLine();
                            }

                            Logger.Debug(String.Format("    [{0}]: {1}", parameters[i].Name, dictionaryBuilder.ToString().TrimEnd(new[] { ',' })));
                        }
                        else if (currentArgument is IEnumerable)
                        {
                            IEnumerable   enumerator        = (IEnumerable)currentArgument;
                            StringBuilder dictionaryBuilder = new StringBuilder();

                            foreach (var item in enumerator)
                            {
                                dictionaryBuilder.AppendFormat("{0},", GetStringValue(item)).AppendLine();
                            }
                            Logger.Debug(String.Format("    [{0}]: {1}", parameters[i].Name, dictionaryBuilder.ToString().TrimEnd(new[] { ',' })));
                        }
                        else
                        {
                            Logger.Debug(String.Format("    [{0}]: {1}", parameters[i].Name, GetStringValue(currentArgument)));
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                Logger.Error(exception);
            }
        }
        public void OnInvoke(CInjection injection)
        {
            if (injection == null) return;

            _injection = injection;

            try
            {
                if (injection.IsValid())
                    Logger.Info(_injection.GetMessage("Invoked"));

                if (!Logger.IsDebugEnabled) return;

                var parameters = injection.Method.GetParameters();
                if (injection.Arguments != null)
                {
                    Logger.Debug(String.Format(">> Paramerters: {0}", injection.Arguments.Length));
                    for (int i = 0; i < injection.Arguments.Length; i++)
                    {
                        var currentArgument = injection.Arguments[i];
                        if (currentArgument == null)
                        {
                            Logger.Debug(String.Format("    [{0}]: <null>", parameters[i].Name));
                            continue;
                        }

                        if (currentArgument is IDictionary)
                        {
                            var dictionary = (IDictionary)currentArgument;
                            var dictionaryBuilder = new StringBuilder();
                            foreach (var key in dictionary.Keys)
                            {
                                dictionaryBuilder.AppendFormat("{0}={1}|", key, GetStringValue(dictionary[key]));
                            }

                            Logger.Debug(String.Format("    [{0}]: {1}", parameters[i].Name, dictionaryBuilder.ToString().TrimEnd(new[] { '|' })));
                        }
                        else if (currentArgument is ICollection)
                        {
                            ICollection collection = (ICollection)currentArgument;
                            IEnumerator enumerator = collection.GetEnumerator();
                            StringBuilder dictionaryBuilder = new StringBuilder();

                            while (enumerator.MoveNext())
                            {
                                dictionaryBuilder.AppendFormat("{0},", GetStringValue(enumerator.Current)).AppendLine();
                            }

                            Logger.Debug(String.Format("    [{0}]: {1}", parameters[i].Name, dictionaryBuilder.ToString().TrimEnd(new[] { ',' })));
                        }
                        else if (currentArgument is IEnumerable)
                        {
                            IEnumerable enumerator = (IEnumerable)currentArgument;
                            StringBuilder dictionaryBuilder = new StringBuilder();

                            foreach (var item in enumerator)
                            {
                                dictionaryBuilder.AppendFormat("{0},", GetStringValue(item)).AppendLine();
                            }
                            Logger.Debug(String.Format("    [{0}]: {1}", parameters[i].Name, dictionaryBuilder.ToString().TrimEnd(new[] { ',' })));
                        }
                        else
                        {
                            Logger.Debug(String.Format("    [{0}]: {1}", parameters[i].Name, GetStringValue(currentArgument)));
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                Logger.Error(exception);
            }
        }