Code Monkey home page Code Monkey logo

Comments (11)

hishamco avatar hishamco commented on September 13, 2024

I'm planning to create FileLoggerProvider that we can subclasses and allow us to create a variety of file logger such as TextLoggerProvider, XmlLoggerProvider .. etc

So can can I make a PR , or shall I write a sample code to show you my humble design?

from orchardcore.

hishamco avatar hishamco commented on September 13, 2024

/cc @Jetski5822

from orchardcore.

Jetski5822 avatar Jetski5822 commented on September 13, 2024

Argh, my comment didn't save.

I think its a good idea to give it a go, have you seen the https://GitHub.com/aspnet/logging work?

I'll comment more tomorrow as on phone at mo.

from orchardcore.

hishamco avatar hishamco commented on September 13, 2024

Of course and I did a humble PRs, so shall I make a PR or write a code snippet first

from orchardcore.

Jetski5822 avatar Jetski5822 commented on September 13, 2024

Lets take a look at a code snippet :)

from orchardcore.

hishamco avatar hishamco commented on September 13, 2024

Sure πŸ˜„

from orchardcore.

hishamco avatar hishamco commented on September 13, 2024

aspnet/Logging#201

from orchardcore.

Jetski5822 avatar Jetski5822 commented on September 13, 2024

So, create a LoggingModule : IModule, add add a Logger based on configuration. Then if we want to log to a file, its just configuration.

Make the default NLog? Or console?

Whatcha think?

from orchardcore.

hishamco avatar hishamco commented on September 13, 2024

Of course the configuration is very handy in almost the providers: logging, authentication .. etc. The ConsoleLogger is good as default logging provider, also we may need sort of CompositeProvider to log into different sources at one shoot, let me take the initiative πŸ˜„ , I planned to do that from few weeks ago but I stuck every time on launching the url, I appreciate your effort to make the fix, it is time to move into this πŸ‘

from orchardcore.

hishamco avatar hishamco commented on September 13, 2024

@Jetski5822 I faced some issues:
1- I got MissingMethodException in GetRefrencingLibraries whenever i'm trying to run unit test
2- Is there a default configuration file that we can put the logger settings
3- If I create a LoggingModule that implement IModule, is the DI of IServiceCollection done out of the box, or shall I do some extra stuff

from orchardcore.

Jetski5822 avatar Jetski5822 commented on September 13, 2024

Okay done! To plug in another logger we just need to create a module and implement the ILoggingInitiator interface. This will then get added to the Logger pipeline at the ApplicationServices level.

i.e.

public class LoggingInitiator : ILoggingInitiator {
    public void Initialize(ILoggerFactory loggerFactory) {
        loggerFactory.AddConsole(LogLevel.Debug);
    }
}

For NLog

public class LoggingInitiator : ILoggingInitiator {
    public void Initialize(ILoggerFactory loggerFactory) {
        loggerFactory.AddNLog(LogLevel.Debug);
    }
}

from orchardcore.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.