Skip to content

Logging the Results

Jaxelr edited this page Dec 18, 2016 · 1 revision

Logging the Results

If you are writing a setup program (and you probably are), you might want to log the output of the upgrade. The SchemaInstaller provides 5 events that you can use to take actions or log the outputs.

  • CreatingObject
  • CreatedObject
  • DroppingObject

Logging the Output

The easiest way to log the output is to create a SchemaEventConsoleLogger and attach it to your installer. This will log the activity to Console.Out.

new SchemaEventConsoleLogger().Attach(installer);

If you want to log to something else, derive a class from SchemaEventLogger and override the LogSchemaChange method.

You can also subscribe to specific events on the SchemaInstaller and handle them individually.