Example #1
0
        public IntervalLogger(object title, IMainElapsedAction action)
            : base()
        {
            this.Record = new LogRecord();
            //var t = title.ToStringX();
            //if(!t.NullOrEmpty()) { this.Record.Title = t; }
            //if(null != action) { this.Action = action; }

            // Tid
            //ScopeContext.Current.Scope.Tid = this.Record.Tid;

            // MethodBase
            var sf = RunTime.CalleeStackFrameBeyond("Log");

            if (null != sf)
            {
                this.Method       = sf.GetMethod();
                this.Record.Path  = this.Method.Path();
                this.Record.Title =
                    this.Record.Title.NullOrEmpty()
                    ||
                    this.Record.Title.Contains("IntervalLogger")
                                                ? this.Method.Description()
                                                : this.Record.Title;
                this.Record.Method = this.Method;
            }
        }
Example #2
0
        private void Init()
        {
            Title = string.Empty;

            Level = LogLevel.Info;

            ExecutionTime = 0L;

            Message = string.Empty;
            Datas   = new SafeList <Any>();


            // MethodBase
            var sf = RunTime.CalleeStackFrameBeyond("LogRecord");

            if (null != sf)
            {
                this.Method = sf.GetMethod();
                Path        = this.Method.Path();
                Title       = Title.NullOrEmpty()
                                        ? this.Method.Description()
                                        : Title;
            }
        }