public void Emit(LogEvent logEvent)
        {
            var alm = ParseLogEventProperties(logEvent, in _formatProvider);

            logServerMessageProducer?.Log(alm.Text, alm.Source, alm.Level, alm.Category, alm.MachineName, alm.User,
                                          alm.Module, alm.ProcessId, alm.ThreadId, alm.AdditionalInformation, alm.MethodName, alm.LineNumber, alm.FileName);
        }
示例#2
0
        static async Task Main(string[] args)
        {
            string ip = "localhost";

            if (args.Length >= 2)
            {
                ip = args[1];
            }

            var p  = new AnalogyMessageProducer($"http://{ip}:6000");
            var ai = new Dictionary <string, string> {
                { "some key", "some value" }
            };

            for (int i = 0; i < 100000; i++)
            {
                await p.Log(text : $@"test {i} ({CurrentFrameworkAttribute.FrameworkName})", source : "none", additionalInformation : ai, level : AnalogyLogLevel.Information).ConfigureAwait(false);

                await Task.Delay(500).ConfigureAwait(false);
            }
        }
        private async void btnProducer_Click(object sender, EventArgs e)
        {
            if (producing)
            {
                return;
            }

            producing           = true;
            btnProducer.Enabled = false;
            var p  = new AnalogyMessageProducer($"http://{txtIP.Text}", null);
            var ai = new Dictionary <string, string> {
                { "some key", "some value" }
            };

            for (int i = 0; i < 100000; i++)
            {
                await p.Log(text : "test " + i, source : "none", additionalInformation : ai, level : AnalogyLogLevel.Information).ConfigureAwait(false);

                await Task.Delay(500).ConfigureAwait(false);
            }

            producing           = false;
            btnProducer.Enabled = true;
        }