Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.

Conversation

@sonjakhan
Copy link
Contributor

A basic implementation of ELM, a wannabe ELMAH. Currently the logs are written to a dictionary and are displayed in plain text

elmloggerinitial

@borgdylan
Copy link

Would it be possible to make the function that writes the dictionary out to the response replaceable in ElmOptions? Like that, I could add transform it into JSON and integrate it into some kind of management dashboard.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Throwing an exception here will make MVC unusable as it relies on BeginScope for its route handler and the default action selector.

If you don't wanna implement it yet, I'd suggest returning either null or a dummy IDisposable (returning null shouldn't be an issue given that BeginScope is only used with using, but a custom IDisposable is probably better).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the catch!

@sonjakhan
Copy link
Contributor Author

@borgdylan I am working on abstracting the storage system of the logs

@borgdylan
Copy link

@sonjakhan that would help a lot since I do all my UI in AngularJS+WInJS which means data is fetched as JSON.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can initialize the property inline. Something like this:

public static List<string> Log { get; set; } = new List<string>();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the setter would be even better 🎉

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is all being removed anyways 😸

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Baby steps 😋

@sonjakhan
Copy link
Contributor Author

This is pretty ugly right now and doesn't show all the data that's stored. Grouping by request, filtering by severity, sorting by time, etc are things I was thinking about implementing but I wanted to get some feedback before I went too far down a bad path. Linking to the full details of a request is also important - currently I store whatever is in LogContext, which is probably missing a couple of properties.

elmlogger2

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I imagine that you could also use an instance store and declare ElmStore as singleton instead of transient.

@sonjakhan
Copy link
Contributor Author

new interface:
elmlogger3

filtering by logger name:
elmlogger4

highlight scope on hover:
elmlogger5

path link shows request details and logs:
elmlogger6

@Tratcher
Copy link
Member

  1. Elm needs to be moved to the Diagnostics repo due to its dependencies.
  2. Remove the MVC dependency from the sample. You can use this Hello World code instead:
    https://github.com/aspnet/Entropy/blob/dev/samples/Builder.HelloWorld.Web/Startup.cs

@sonjakhan
Copy link
Contributor Author

Working on fixes to scoping, and will reopen a pull request in the Diagnostics repo when finished.

@sonjakhan sonjakhan closed this Oct 28, 2014
@sonjakhan sonjakhan deleted the elm branch December 12, 2014 19:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants