Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactored the library #21

Merged
merged 12 commits into from Jan 29, 2019
Next

Fixed two failing formatter tests

  • Loading branch information
Jiří Tomek
Jiří Tomek committed Nov 14, 2018
commit 393c1607e4f92ae1c1b798db10714aea6ed5435b
@@ -73,7 +73,7 @@ public void ShouldAddALoggerNameProperty()
[Fact]
public void ShouldAddAMessagePropertyForEventsWithoutMessages()
{
var evt = _fixture.Create<LoggingEvent>();
var evt = new LoggingEvent(new LoggingEventData() { Level = Level.Info });
var instance = _fixture.Create<LogglyFormatter>();

var result = instance.ToJson(evt);
@@ -134,7 +134,7 @@ public void ShouldAddExtraPropertiesWhenMessageObjectIsAComplexType()
{
var evt = new LoggingEvent(
GetType(),
Mock.Of<ILoggerRepository>(),
null,
_fixture.Create("loggerName"),
_fixture.Create<Level>(),
_fixture.Create<ComplexType>(),
@@ -15,6 +15,7 @@ public class LogglyFormatter : ILogglyFormatter
{
private readonly Process _currentProcess;

// TODO: Make configurable? Is it documented?
public int EVENT_SIZE = 1000 * 1000;

public LogglyFormatter()
@@ -118,6 +119,11 @@ private string GetMessageAndObjectInfo(LoggingEvent loggingEvent, out object obj
objInfo = null;
var bytesLengthAllowedToLoggly = EVENT_SIZE;

if (loggingEvent.MessageObject != null)
{
objInfo = loggingEvent.MessageObject;
}

if (!string.IsNullOrEmpty(loggingEvent.RenderedMessage))
{
message = loggingEvent.RenderedMessage;
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.