Exemple #1
0
 public override object DoInvoke(InvocationInfo info)
 {
     _logger.Log($"Invoking method: {info.TargetMethod.Name}");
     // may be optimized, because we know the actual `Target` object here.
     //if (info.TargetMethod.Name == nameof(IBar.Greet))
     //    Target.Greet();
     return(base.DoInvoke(info));
 }
Exemple #2
0
        public void NoArgsEncodeTest()
        {
            _fooLogger.Log(LogLevel.Info, FooMsgId.Foo);
            _barLogger.Log(LogLevel.Warning, BarMsgId.HelloWorld);

            _stream.Seek(0, SeekOrigin.Begin);
            var entries = _logDecoder.Decode(_stream).ToArray();

            Assert.True(entries[0].Channel == _fooDecoder.ChannelName);
            Assert.True(entries[1].Channel == _barDecoder.ChannelName);

            Assert.True(entries[0].LogLevel == LogLevel.Info);
            Assert.True(entries[1].LogLevel == LogLevel.Warning);

            Assert.True(entries[0].Message == _fooDecoder.DecodeMessage(FooMsgId.Foo));
            Assert.True(entries[1].Message == _barDecoder.DecodeMessage(BarMsgId.HelloWorld));

            Assert.True(entries[0].DateTimeUtc <= entries[1].DateTimeUtc);
        }