diff options
Diffstat (limited to 'Software/Visual_Studio/Tango.Logging/FileLogger.cs')
| -rw-r--r-- | Software/Visual_Studio/Tango.Logging/FileLogger.cs | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/Software/Visual_Studio/Tango.Logging/FileLogger.cs b/Software/Visual_Studio/Tango.Logging/FileLogger.cs index e104b59b9..215b1d9ac 100644 --- a/Software/Visual_Studio/Tango.Logging/FileLogger.cs +++ b/Software/Visual_Studio/Tango.Logging/FileLogger.cs @@ -13,6 +13,10 @@ namespace Tango.Logging /// <seealso cref="Tango.Logging.ILogger" /> public class FileLogger : ILogger { + /// <summary> + /// Gets the logs folder. + /// </summary> + public static String DefaultLogsFolder { get; private set; } /// <summary> /// Gets or sets the log file. @@ -20,14 +24,21 @@ namespace Tango.Logging public String LogFile { get; private set; } /// <summary> + /// Initializes the <see cref="FileLogger"/> class. + /// </summary> + static FileLogger() + { + DefaultLogsFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Twine", "Tango", "logs"); + } + + /// <summary> /// Initializes a new instance of the <see cref="FileLogger"/> class. /// </summary> public FileLogger() { _isEnabled = true; - String logsFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Twine", "Tango", "logs"); - Directory.CreateDirectory(logsFolder); - LogFile = Path.Combine(logsFolder, string.Format("{1}-{0:dd-MM-yyyy_hh-mm-ss}.log", DateTime.Now, Path.GetFileNameWithoutExtension(System.AppDomain.CurrentDomain.FriendlyName))); + Directory.CreateDirectory(DefaultLogsFolder); + LogFile = Path.Combine(DefaultLogsFolder, string.Format("{1}-{0:dd-MM-yyyy_HH-mm-ss}.log", DateTime.Now, Path.GetFileNameWithoutExtension(AppDomain.CurrentDomain.FriendlyName))); } /// <summary> |
