mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[Logger] Create separate logfiles for each instance
This commit is contained in:
@@ -8,7 +8,6 @@ namespace SabreTools.Helper
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Things to do:
|
/// Things to do:
|
||||||
/// - Create log files by date
|
|
||||||
/// - Clean up log files if there are more than x number per program
|
/// - Clean up log files if there are more than x number per program
|
||||||
/// - Allow for "triggerable" logging done on an interval (async)
|
/// - Allow for "triggerable" logging done on an interval (async)
|
||||||
/// - Log filtering? (#if debug?)
|
/// - Log filtering? (#if debug?)
|
||||||
@@ -46,11 +45,11 @@ namespace SabreTools.Helper
|
|||||||
/// Initialize a Logger object with the given information
|
/// Initialize a Logger object with the given information
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="tofile">True if file should be written to instead of console</param>
|
/// <param name="tofile">True if file should be written to instead of console</param>
|
||||||
/// <param name="filename">Optional filename representing log location</param>
|
/// <param name="filename">Filename representing log location</param>
|
||||||
public Logger(bool tofile, string filename = "")
|
public Logger(bool tofile, string filename)
|
||||||
{
|
{
|
||||||
_tofile = tofile;
|
_tofile = tofile;
|
||||||
_filename = filename;
|
_filename = Path.GetFileNameWithoutExtension(filename) + " (" + DateTime.Now.ToString("yyyy-MM-dd HHmmss") + ")" + Path.GetExtension(filename);
|
||||||
|
|
||||||
if (!Directory.Exists(_basepath))
|
if (!Directory.Exists(_basepath))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user