Files
UnrealEngineUWP/Engine/Source/Programs/nDisplayLauncher/AppLog/AppLogger.cs
jerome delattre 9dcdc6c566 #ROBOMERGE-AUTHOR: jerome.delattre
Copying //Tasks/UE4/Release-4.20-EnterpriseLateFeatures to Release-4.20 (//UE4/Release-4.20)
#rb simon.tourangeau
#jira UE-59798, UE-58919, UE-59480

#ROBOMERGE-SOURCE: CL 4119095 in //UE4/Release-4.20/...
#ROBOMERGE-BOT: RELEASE (Release-4.20 -> Release-Staging-4.20)

[CL 4119100 by jerome delattre in Staging-4.20 branch]
2018-06-07 18:49:50 -04:00

70 lines
1.3 KiB
C#

// Copyright 1998-2018 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;
}
}
}