public void RunProcessAndLogToTextFile() { TextFileLogger textFileLogger = new TextFileLogger(); try { //Run process } catch (Exception ex) { textFileLogger.LogMessage(ex.Message); } }