Giter Club home page Giter Club logo

Comments (4)

pdeligia avatar pdeligia commented on June 15, 2024 1

Thanks for confirming @suvamM. What you are asking will indeed be available as soon as the new logging infrastructure gets released soon. Capturing debug logs from Coyote to a custom logger was not available today (without hacks that intercept console output), that is why you were unable to see them.

from coyote.

pdeligia avatar pdeligia commented on June 15, 2024

We are not able to support custom logging for xUnit or an API specific for xUnit from inside Coyote, else we need to do the same for every single framework. (We also do not want to be too opinionated, different xUnit users might want to use variations of a logger. We want to be able to support the most generic scenario and users can specialize from there.) Unless you are thinking something else here, in which case could you elaborate on what that API would look like?

The stance Coyote takes is to provide a generic ILogger interface that users can implement for their own needs and register it to the testing engine. If you have an existing logger in your application, it is easy to convert it to ILogger as it's based on the System.IO.TextWriter class of C# and just need to implement this interface.

Coyote itself uses xUnit for its regression test suite, and the logging there works without issues today. See base test class here.

var logger = new TestOutputLogger(this.TestOutput);
var engine = new TestingEngine(configuration, test)
{
  Logger = logger
};

As I mentioned offline, an updated ILogger is scheduled for an upcoming release soon that polishes this experience more, introduces levels of verbosity (including Debug, which currently Coyote does not forward to a custom logger) and introduces a new flag for writing logs to console (currently WithVerbosityEnabled is forwarding to console if enabled). But that should not affect your current situation.

Saying the above, I am not sure why your xUnit logger is not printing messages as I am not familiar with your code. Can you elaborate on what kind of messages are you trying to print with an example and how you are printing them?

Note that the logger you install to the testing engine of Coyote is only used to capture output that the Coyote engine logs (for task-based programs that means only debug logs on scheduling decisions, no application logs; for actor-based programs it also logs all the actor related events, like sending events and creating actors). If your application has custom log output, then Coyote does not capture that unless you redirect it manually to the same logger that you are installing to the TestingEngine. From inside the application you then need to use that logger (instead of e.g. writing to Console with Console.WriteLine(...)). Like in this sample here. Let me know if this helps.

from coyote.

pdeligia avatar pdeligia commented on June 15, 2024

Btw, if curious, the new logging infra is available in this PR #377, but currently requires building Coyote from source.

from coyote.

suvamM avatar suvamM commented on June 15, 2024

@pdeligia Thanks for the comment! The scenario I am looking for is a clean way to emit Coyote debug logs only, and not application specific logs. I'll wait for the upcoming version to try out the functionality.

from coyote.

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.