Skip to content

Instantly share code, notes, and snippets.

@hagbarddenstore
Created July 29, 2013 14:38
Show Gist options
  • Save hagbarddenstore/6104769 to your computer and use it in GitHub Desktop.
Save hagbarddenstore/6104769 to your computer and use it in GitHub Desktop.
interface ILogger
{
void Log(string message);
}
class WriteToLogFile
{
private string _logFilePath;
public string LogFilePath
{
get
{
if (string.IsNullOrEmpty(_logFilePath))
{
_logFilePath = ConfigurationManager.AppSettings["LogFilePath"];
}
return _logFilePath;
}
set
{
_logFilePath = value;
}
}
public void Log(string message)
{
// TODO: Implement the actual logging stuff...
}
}
class MyController : Controller
{
private ILogger _logger;
public MyController(ILogger logger)
{
_logger = logger;
}
public ActionResult Log(string message)
{
_logger.Log(message);
return Content("It was logged!");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment