コード例 #1
0
        public TomatoLogClientRedisTest()
        {
            EventRedisOptions options = new EventRedisOptions
            {
                Channel          = "TomatoLogChannel",
                ConnectionString = "127.0.0.1:6379,defaultDatabase=10,password=123456",
                Logger           = null,
                LogLevel         = Microsoft.Extensions.Logging.LogLevel.Information,
                ProjectLabel     = "20272",
                ProjectName      = "TomatoLog-Server",
                SysOptions       = new EventSysOptions
                {
                    EventId     = true,
                    IP          = true,
                    IPList      = true,
                    MachineName = true,
                    ProcessId   = true,
                    ProcessName = true,
                    ThreadId    = true,
                    Timestamp   = true,
                    UserName    = true
                },
                Tags    = null,
                Version = "1.0.1"
            };

            client = new TomatoLogClientRedis(options);
        }
コード例 #2
0
        public TomatoLogClientRabbitMQTest()
        {
            EventRabbitMQOptions options = new EventRabbitMQOptions
            {
                Logger       = null,
                LogLevel     = Microsoft.Extensions.Logging.LogLevel.Information,
                ProjectLabel = "20272",
                ProjectName  = "TomatoLog",
                SysOptions   = new EventSysOptions
                {
                    EventId     = true,
                    IP          = true,
                    IPList      = true,
                    MachineName = true,
                    ProcessId   = true,
                    ProcessName = true,
                    ThreadId    = true,
                    Timestamp   = true,
                    UserName    = true
                },
                Tags         = null,
                Version      = "1.0.1",
                Exchange     = "TomatoLog-Exchange",
                ExchangeType = "direct",
                Host         = "127.0.0.1",
                Password     = "******",
                Port         = 5672,
                QueueName    = "TomatoLog-Queue",
                RouteKey     = "All",
                UserName     = "******",
                vHost        = "TomatoLog"
            };

            client = new TomatoLogClientRabbitMQ(options);
        }
コード例 #3
0
        public TomatoLogClientKafkaTest()
        {
            var options = new EventKafkaOptions
            {
                Logger       = null,
                LogLevel     = Microsoft.Extensions.Logging.LogLevel.Information,
                ProjectLabel = "20272",
                ProjectName  = "TomatoLog",
                SysOptions   = new EventSysOptions
                {
                    EventId     = true,
                    IP          = true,
                    IPList      = true,
                    MachineName = true,
                    ProcessId   = true,
                    ProcessName = true,
                    ThreadId    = true,
                    Timestamp   = true,
                    UserName    = true
                },
                Tags             = null,
                Version          = "1.0.1",
                BootstrapServers = "127.0.0.1:9092",
                Topic            = "TomatoLog"
            };

            client = new TomatoLogClientKafka(options);
        }
コード例 #4
0
        public static ILoggerFactory UseTomatoLogger(this ILoggerFactory factory, ITomatoLogClient logClient)
        {
            if (logClient == null)
            {
                throw new ArgumentNullException(nameof(logClient));
            }

            factory.AddProvider(new TomatoLogClientLoggerProvider(logClient));
            return(factory);
        }
コード例 #5
0
 public HomeController(ILogger <HomeController> logger, ITomatoLogClient logClient)
 {
     this.logger    = logger;
     this.logClient = logClient;
 }
コード例 #6
0
 public static void Set(ITomatoLogClient client, LogFlowTypes flowType)
 {
     CachedClient = client ?? throw new ArgumentNullException(nameof(client));
     FlowType     = flowType;
 }
コード例 #7
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory factory, ITomatoLogClient logClient)
        {
            factory.UseTomatoLogger(logClient);
            if (env.EnvironmentName == Environments.Development)
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
            });
        }
コード例 #8
0
 public TomatoLogClientLoggerProvider(ITomatoLogClient logClient)
 {
     this.logClient = logClient;
     loggers        = new ConcurrentDictionary <string, TomatoLogClientLogger>();
 }
コード例 #9
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory factory, ITomatoLogClient logClient)
        {
            factory.UseTomatoLogger(logClient);
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseMvc();
        }
コード例 #10
0
 public HomeController(ITomatoLogClient logClient)
 {
     this.logClient = logClient;
 }