Logging and Configuration |
Examples of logging and configuration.
Nova.CodeDOM includes a logging class that logs status messages to the Console Window by default. It uses this for it's own logging, but you might also find it useful. Use the Log class to log your own messages like this:
Log.WriteLine("message"); Log.DetailWriteLine("detail message"); // Only logged if LogLevel is set to Detailed Log.Exception(ex, "message"); // Log an Exception object and message
To intercept these log messages, you may install your own handler method of type 'void delegate(string, string)':
Log.SetLogWriteLineCallback(LoggingMethod);
To change the level of logging, or turn it off, set the LogLevel property, like this:
Log.LogLevel = Log.Level.Detailed; Log.LogLevel = Log.Level.None;
Note |
---|
If you do not intercept or turn off logging, it might slow down processing considerably if a large number of messages are being sent to the console (such as if many parse and/or resolve errors are generated). |
Various runtime options are available in a config file, and are documented there. See the Nova.CLI.exe.config file as an example and a template for your own config file. You may wish to move some or all of these options to the config file of the application that uses Nova.CodeDOM.
All configuration options may also be controlled manually at runtime by setting the appropriate static class member, such as:
Resolving.Resolver.ExactMatching = false; CodeObject.UseTabs = true; CodeObject.AutomaticFormattingCleanup = false; CodeObject.AutomaticCodeCleanup = false; Project.DisableMultithreading = true;