public void Reset()
 {
     State.Reset();
     Sld.Reset();
     DataReceiver.Reset();
     ProviderQueue.Reset();
     LearnerQueue.Reset();
     Context.Reset();
 }
Esempio n. 2
0
        ///// <summary>
        ///// Test Logs Data
        ///// </summary>
        //public static Lst[] Tl()
        //{
        //    var r = _.l<Lst>();

        //    var tc = true._Ls();
        //    tc.G(e => eGsl)

        //    //var a1 = new Lst();
        //    //a1.C = new Cde() { C = "Class 11", M = new Cme() { G = _.g, M = "Method 1111" }.L(new Cme() { G = _.g, M = "Method 1122" }) }
        //    //    .L(new Cde() { C = "Class 22", M = new Cme() { G = _.g, M = "Method 2211" }.L(new Cme() { G = _.g, M = "Method 2222" }) });
        //    //a1.E = new Err() { As = 4, C = "Err 1111" }.L(new Err() { As = 33, C = "Err 222" });
        //    //a1.En = new Env() { Ct = 20, Os = "dbs L 1111", S = "server L 11" }.L(new Sq() { T = 30, D = "dbs L 222", S = "server L 22" });
        //    //a1.Q = new Sq() { T = 20, D = "dbs Q 1111", S = "server Q 11" }.L(new Sq() { T = 30, D = "dbs Q 222", S = "server Q 22" });


        //    return r.a();
        //}

        #endregion

        #region common methods

        /// <summary>
        /// Run new Async common MethodToRunAsync using new context with logging settings and save logs after completed
        /// </summary>
        public static async Task R <T>(this Sld Settings, string ConnectionName, IDictionary <T, Cx> Contexts, T ContextKey, f <Ax <T>, Cx, Task> MethodToRunAsync, Mx MethodContext = null, bool Ensure = true)
        {
            var rs = ConnectionName.Gsl();
            var a  = Settings.N(async e => await e.ua(ConnectionName), Contexts);

            var rs1 = a.r(async x =>
            {
                await MethodToRunAsync(a, x);
                return(1);
            }, ContextKey, MethodContext);
            await a.L.Sva();
        }
Esempio n. 3
0
        /// <summary>
        /// Run new Sync common MethodToRunSync using new context with logging settings and save logs after completed
        /// </summary>
        public static void r <T>(this Sld Settings, string ConnectionName, IDictionary <T, Cx> Contexts, T ContextKey, v <Ax <T>, Cx> MethodToRunSync, Mx MethodContext = null, bool Ensure = true)
        {
            var rs = ConnectionName.Gsl();
            var a  = Settings.N(async e => await e.ua(ConnectionName), Contexts);

            var rs1 = a.r(x =>
            {
                MethodToRunSync(a, x);
                return(1);
            }, ContextKey, MethodContext);

            a.L.Sv();
        }
Esempio n. 4
0
 /// <summary>
 /// Get Common Sync Context with errors and performance with process details
 /// </summary>
 public Ax(Sld CurrSession, f <Lst, bool> SyncSaveLogsMethod, IDictionary <Tx, Cx> BaseContexts = null)
     : base(null, true)
 {
     T      = BaseContexts;
     L      = CurrSession.N(SyncSaveLogsMethod);
     this.M = () =>
     {
         if (L != null)
         {
             L.Sv();
         }
         return(true);
     };
 }
Esempio n. 5
0
        /// <summary>
        /// Get new Common SessionLog from current CurrentLogSettings to Log Init with MaxLogsLimit
        /// </summary>
        public static Sld N(this Sls CurrentLogSettings, string SolutionTitle = null, int?MaxLogsLimit = 10000)
        {
            var r = new Sld();

            r.I = _.g;
            r.A = Assembly.GetExecutingAssembly().ToString();

            r.S  = CurrentLogSettings;
            r.M  = MaxLogsLimit;
            r.D  = _.D;
            r.Du = _.d;
            r.T  = SolutionTitle;

            return(r);
        }
Esempio n. 6
0
 /// <summary>
 /// Start Sync logger with parameters from CurrLogSession
 /// </summary>
 public void I(Sld CurrSession = null)
 {
     S  = CurrSession;
     L  = new Lst().I(S);
     Ls = new List <Lst>();
     Rn = 0;
     Rl = -1;
     if (S.M != null && S.M.Value > 1)
     {
         Rl = S.M.Value;
     }
     if (S != null && S.S != null && S.S.L == true)
     {
         C = S.S;
     }
 }
Esempio n. 7
0
        /// <summary>
        /// Get Common Async Context with errors and performance with process details
        /// </summary>
        public Ax(Sld CurrSession, f <Lst, Task <bool> > AsyncSaveLogsMethod, IDictionary <Tx, Cx> BaseContexts = null)
            : base(null, true)
        {
            T      = BaseContexts;
            L      = CurrSession.N(AsyncSaveLogsMethod);
            this.M = () =>
            {
                if (L != null)
                {
                    var r = L.Sva();
                    if (r != null)
                    {
                        var rs = r.Result;
                    }
                }

                return(true);
            };
        }
Esempio n. 8
0
        /// <summary>
        /// Init new Logs Storage for logger using CollectDetailsSettings
        /// </summary>
        public static Lst I(this Lst CurrLogsStorage, Sld CollectDetailsSettings)
        {
            var r = CurrLogsStorage;

            r.S = CollectDetailsSettings;

            if (r.S != null && r.S.S != null)
            {
                r.C = new List <Mx>();
                r.X = new List <Cx>();
                r.E = new List <Err>();
                r.I = new List <Inf>();

                var s = r.S.S;
                if (s.En == true)
                {
                    r.En = new List <Env>();
                }
                if (s.P == true)
                {
                    r.P = new List <Prf>();
                }
                if (s.Pr == true)
                {
                    r.Pr = new List <Prc>();
                }
                if (s.Pp == true)
                {
                    r.Pd = new List <Prd>();
                }
                if (s.Hr == true)
                {
                    r.Hr = new List <Hrq>();
                }
                if (s.Hs == true)
                {
                    r.Hs = new List <Hsl>();
                }
                if (s.Hc == true)
                {
                    r.Hc = new List <Hcx>();
                }
                if (s.Wp == true)
                {
                    r.Wp = new List <Wpl>();
                }
                if (s.Wr == true)
                {
                    r.Wpr = new List <Wpr>();
                }
                if (s.B == true)
                {
                    r.Hb = new List <Hbc>();
                }
                if (s.U == true)
                {
                    r.Wi = new List <Wil>();
                }
            }

            return(CurrLogsStorage);
        }
Esempio n. 9
0
 /// <summary>
 /// Get new Async logger with parameters from current CurrLogSession
 /// </summary>
 public static Lg N(this Sld CurrSession, f <Lst, Task <bool> > AsyncSaveLogsMethod)
 {
     return(new Lg(AsyncSaveLogsMethod, CurrSession));
 }
Esempio n. 10
0
        ///// <summary>
        ///// Set Common ASP additional settings for  current CurrentSessionLog with error logs enabled
        ///// </summary>
        //public static Sld S(this Sld CurrentSessionLog, bool CollectErrorDetails = true, bool CollectPerfDetails = true, bool CollectUsers = true, bool CollectOSData = true, int? MaxLogsLimit = 10000)
        //{
        //    var r = CurrentSessionLog;

        //    r.I = _.g;
        //    r.A = Assembly.GetExecutingAssembly().ToString();

        //    r.Ced = CollectErrorDetails;
        //    r.Cpd = CollectPerfDetails;
        //    r.Cu = CollectUsers;
        //    r.Co = CollectOSData;
        //    r.M = MaxLogsLimit;

        //    return CurrentSessionLog;
        //}

        /// <summary>
        /// Get new Sync logger with parameters from current CurrLogSession
        /// </summary>
        public static Lg N(this Sld CurrSession, f <Lst, bool> SyncSaveLogsMethod)
        {
            return(new Lg(SyncSaveLogsMethod, CurrSession));
        }
Esempio n. 11
0
 /// <summary>
 /// Start Async logger with AsyncSaveLogsMethod and parameters from CurrLogSession
 /// </summary>
 public Lg(f <Lst, Task <bool> > AsyncSaveLogsMethod, Sld CurrSession = null)
 {
     Sa = AsyncSaveLogsMethod;
     I(CurrSession);
 }
Esempio n. 12
0
 /// <summary>
 /// Start Sync logger with SyncSaveLogsMethod and parameters from CurrLogSession
 /// </summary>
 public Lg(f <Lst, bool> SyncSaveLogsMethod, Sld CurrSession = null)
 {
     Sm = SyncSaveLogsMethod;
     I(CurrSession);
 }
Esempio n. 13
0
 /// <summary>
 /// Get new Async Common App Context from current CurrSession with SaveLogsMethod and BaseContexts
 /// </summary>
 public static Ax <Tx> N <Tx>(this Sld CurrSession, f <Lst, Task <bool> > AsyncSaveLogsMethod, IDictionary <Tx, Cx> BaseContexts = null)
 {
     return(new Ax <Tx>(CurrSession, AsyncSaveLogsMethod, BaseContexts));
 }