Question

I'm trying out the Starcounter Beta, and I would like to create LogSources.

I did find the class Starcounter.LogSources, which has the property Hosting of type Starcounter.Logging.LogSource.

But I don't understand how to define my own log source, any help is appreciated.

Was it helpful?

Solution

Sorry the documentation wasn't enough in this case; it's one of the things we are really working on to improve.

The Starcounter.LogSources class is just a single place we keep a few well-known log sources, like SQL and Hosting (that you mentioned). These are normally just used by the database engine.

To create and start logging with your own source, it's as easy as:

var log = new LogSource("Foo");
log.LogWarning("I've break loose!");

Just make sure you've referenced the Starcounter.Logging assembly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top