Files
UnrealEngineUWP/Engine/Source/Programs/nDisplayLauncher/AppLog/AppLogger.cs
ben marsh 2b46ba7b94 Update copyright notices to 2019.
#rb none
#lockdown Nick.Penwarden

#ROBOMERGE-OWNER: ryan.gerleve
#ROBOMERGE-AUTHOR: ben.marsh
#ROBOMERGE-SOURCE: CL 4662404 in //UE4/Main/...
#ROBOMERGE-BOT: ENGINE (Main -> Dev-Networking)

[CL 4662413 by ben marsh in Dev-Networking branch]
2018-12-14 13:44:01 -05:00

70 lines
1.3 KiB
C#

// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
using System;
using System.ComponentModel;
namespace nDisplayLauncher
{
public class AppLogger : INotifyPropertyChanged
{
private AppLogger()
{
}
//Implementation of INotifyPropertyChanged method for TwoWay binding
public event PropertyChangedEventHandler PropertyChanged;
protected void OnNotifyPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
//Set property with OnNotifyPropertyChanged call
protected void Set<T>(ref T field, T newValue, string propertyName)
{
field = newValue;
OnNotifyPropertyChanged(propertyName);
}
private static AppLogger _Instance;
public static AppLogger Instance
{
get
{
if (_Instance == null)
{
_Instance = new AppLogger();
}
return _Instance;
}
}
private string _Log;
public string Log
{
get
{
if (_Log == null)
{
_Log = string.Empty;
}
return _Log;
}
set { Set(ref _Log, value, "Log"); }
}
public static void CleanLog()
{
Instance.Log = DateTime.Now.ToString() + System.Environment.NewLine;
}
public static void Add(string text)
{
Instance.Log = Instance.Log + DateTime.Now.ToString() + ": " + text + System.Environment.NewLine;
}
}
}