Exemple #1
0
        async Task <SessionHeaderItem> GetSessionAsync(ILoggingEnvironment environment)
        {
            // check...
            Monitor.Enter(_headersLock);
            SessionHeaderItem header = null;

            try
            {
                if (Headers.TryGetValue(environment.SessionId, out header) == false)
                {
                    var conn = GetConnection();
                    header = await conn.Table <SessionHeaderItem>().Where(v => v.SessionGuid == environment.SessionId).FirstOrDefaultAsync();

                    if (header == null)
                    {
                        header = SessionHeaderItem.CreateForEnvironment(environment);
                        await conn.InsertAsync(header);
                    }
                    // set...
                    Headers[environment.SessionId] = header;
                }
            }
            finally
            {
                Monitor.Exit(_headersLock);
            }

            // return...
            return(header);
        }
Exemple #2
0
        private async Task<SessionHeaderItem> GetSessionAsync(ILoggingEnvironment environment)
        {
            // check...
            Monitor.Enter(_headersLock);
            SessionHeaderItem header = null;
            try
            {
                if (Headers.TryGetValue(environment.SessionId, out header) == false)
                {
                    var conn = GetConnection();
                    header = await conn.Table<SessionHeaderItem>().Where(v => v.SessionGuid == environment.SessionId).FirstOrDefaultAsync();
                    if (header == null)
                    {
                        header = SessionHeaderItem.CreateForEnvironment(environment);
                        await conn.InsertAsync(header);
                    }
                    // set...
                    Headers[environment.SessionId] = header;
                }
            }
            finally
            {
                Monitor.Exit(_headersLock);
            }

            // return...
            return header;
        }
Exemple #3
0
        private async Task <SessionHeaderItem> GetSessionAsync(ILoggingEnvironment environment)
        {
            // check...
            lock (_headersLock)
            {
                if (Headers.ContainsKey(environment.SessionId))
                {
                    return(Headers[environment.SessionId]);
                }
            }

            var conn   = GetConnection();
            var header = await conn.Table <SessionHeaderItem>().Where(v => v.SessionGuid == environment.SessionId).FirstOrDefaultAsync();

            if (header == null)
            {
                header = SessionHeaderItem.CreateForEnvironment(environment);
                await conn.InsertAsync(header);
            }

            // set...
            lock (_headersLock)
            {
                if (!(Headers.ContainsKey(environment.SessionId)))
                {
                    Headers[environment.SessionId] = header;
                }
            }

            // return...
            return(header);
        }
Exemple #4
0
        private async Task<SessionHeaderItem> GetSessionAsync(ILoggingEnvironment environment)
        {
            // check...
            lock (_headersLock)
            {
                if (Headers.ContainsKey(environment.SessionId))
                    return Headers[environment.SessionId];
            }

            var conn = GetConnection();
            var header = await conn.Table<SessionHeaderItem>().Where(v => v.SessionGuid == environment.SessionId).FirstOrDefaultAsync();
            if(header == null)
            {
                header = SessionHeaderItem.CreateForEnvironment(environment);
                await conn.InsertAsync(header);
            }

            // set...
            lock (_headersLock)
            {
                if (!(Headers.ContainsKey(environment.SessionId)))
                    Headers[environment.SessionId] = header;
            }

            // return...
            return header;
        }
 internal static SessionHeaderItem CreateForEnvironment(ILoggingEnvironment environment)
 {
     return(new SessionHeaderItem()
     {
         SessionGuid = environment.SessionId,
         Data = environment.ToJson()
     });
 }
 internal static SessionHeaderItem CreateForEnvironment(ILoggingEnvironment environment)
 {
     return new SessionHeaderItem() 
     {
         SessionGuid = environment.SessionId,
         Data = environment.ToJson()
     };
 }
Exemple #7
0
 static LogWriteContext()
 {
     _environment = new LoggingEnvironment();
 }
Exemple #8
0
 internal JsonPostWrapper(ILoggingEnvironment environment, IEnumerable<LogEventInfo> events)
 {
     this.Environment = environment;
     this.Events = events.ToArray();
 }
Exemple #9
0
 static LogWriteContext()
 {
     _environment = PlatformAdapter.Resolve<ILoggingEnvironment>();
 }
Exemple #10
0
 internal JsonPostWrapper(ILoggingEnvironment environment, IEnumerable <LogEventInfo> events)
 {
     Environment = environment;
     Events      = events.ToArray();
 }
Exemple #11
0
 static LogWriteContext()
 {
     _environment = PlatformAdapter.Resolve <ILoggingEnvironment>();
 }