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

Accessing the log messages #87

Open
chelliwell opened this issue Oct 29, 2019 · 1 comment
Open

Accessing the log messages #87

chelliwell opened this issue Oct 29, 2019 · 1 comment
Labels

Comments

@chelliwell
Copy link
Contributor

I see that some of the classes make use of LoggerFactory, and that an example app has a section "Using dependency injection and console logging". Is it possible to use the latter without the former? If so, could you maybe add a doc section about a basic method/example to grab these messages in the 'client' code?

@sahb1239
Copy link
Owner

The LoggerFactory interface is from Microsoft.Extensions.Logging which is for example used with ASP.net Core. The loggerfactory interface is injected using property injection like this:

new GraphQLFieldBuilder() { LoggerFactory = provider.GetService<ILoggerFactory>() }

The code is from here:
https://github.com/sahb1239/SAHB.GraphQLClient/blob/develop/src/SAHB.GraphQLClient/GraphQLClientBuilder.cs#L28

Some examples of using loggerfactory can be found here:
https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging/?view=aspnetcore-3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants