Exemplo n.º 1
0
        public async Task WriteLogAsync()
        {
            for (int i = 0; i < 1000; i++)
            {
                await client.WriteLogAsync(1001, LogLevel.Debug, "ES Exception", null, null);

                await client.WriteLogAsync(1001, LogLevel.Information, "ES Exception", null, null);

                await client.WriteLogAsync(1001, LogLevel.Critical, "ES Exception", null, null);

                await client.WriteLogAsync(1001, LogLevel.None, "ES Exception", null, null);

                await client.WriteLogAsync(1001, LogLevel.Trace, "ES Exception", null, null);

                await client.WriteLogAsync(1001, LogLevel.Warning, "ES Exception", null, null);

                await client.WriteLogAsync(1001, LogLevel.Error, "ES Exception", null, null);

                //try
                //{
                //    throw new Exception("RabbitMQ throw exception");
                //}
                //catch (Exception ex)
                //{
                //    await ex.AddTomatoLogAsync(1320);
                //}
            }
        }
Exemplo n.º 2
0
        public async Task <ActionResult <IEnumerable <string> > > Get()
        {
            try
            {
                await logClient.WriteLogAsync(1029, LogLevel.Warning, "Warning Infomation", "Warning Content", new { LastTime = DateTime.Now, Tips = "Warning" });

                throw new NotSupportedException("NotSupported Media Type");
            }
            catch (Exception ex)
            {
                await ex.AddTomatoLogAsync();
            }
            return(new string[] { "value1", "value2" });
        }