What is the best design to this class?
- by HPT
assume this class:
public class Logger
{
static TextWriter fs = null;
public Logger(string path)
{
fs = File.CreateText(path);
}
public static void Log(Exception ex)
{
///do logging
}
public static void Log(string text)
{
///do logging
}
}
and I have to use this like:
Logger log = new Logger(path);
and then use Logger.Log() to log what I want.
the question is: is this a good design? to instantiate a class and then always call it's static method? any suggestion yield in better design is appreciated.