larytet / larytet-master

Automatically exported from code.google.com/p/larytet-master
0 stars 1 forks source link

Redundand code when building log filename #8

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I would add a public static method which returns the paths, for example,

string Resources.GetLogsFolder()

and method which builds filename for all logs in the system
Resources.CreateLogFilename(string name, LogType type)
{
   string filename = Resources.GetLogsFolder() +  DateNowToFilename();
   switch (type)
  {
    case CSV: filename += ".csv";
  }
 return filename;
}

In the LoLogMaof call will look like

string filename = CreateLogFilename("MaofLog_",  LogType.CSV);

This way all filenames are generated in the same place and unified.

Original issue reported on code.google.com by larytet@gmail.com on 13 Oct 2009 at 7:56