diff --git a/Event Logger/EventLogController.cs b/Event Logger/EventLogController.cs index fd8c586e7ec2dd7037372bf107e752eaea15f1d8..c0e68b9ef80e92a4ea275f59553926f9b24cf4ad 100644 --- a/Event Logger/EventLogController.cs +++ b/Event Logger/EventLogController.cs @@ -6,18 +6,20 @@ namespace Shared.EventLog { // A Component in charge of starting an event log and writing it to a file on completion // Depends on ScriptableVariable package public class EventLogController : MonoBehaviour { + [Header("Input Variables")] [Tooltip("The event log to write out to a file")] public EventLog eventLog; - - [Tooltip("Event to fire when logging has started")] - public GameEvent loggingStarted; - [Tooltip("The filename of the log file generated by an event log")] public StringVariable logFileName; - [Tooltip("The output directory to write the log file to")] public StringVariable outputDirectory; + [Header("Output Events")] + [Tooltip("Event to fire when logging has started")] + public GameEvent loggingStarted; + [Tooltip("Event to fire when logging has stopped, passing in the filename as the parameter")] + public StringGameEvent loggingStopped; + private DateTime startTime = DateTime.Now; private bool isLogging = false; @@ -37,10 +39,12 @@ namespace Shared.EventLog { // Add an end time event log, write the event log out to file, and clear the event log of events public void StopLogging() { if (isLogging) { - DateTime endTime = DateTime.Now; + var endTime = DateTime.Now; + var outputFilename = logFileName.Value + "." + endTime.ToString("MM-dd-yyy-HHmmss") + ".csv"; eventLog.Add("end-time", endTime.ToString("HH:mm:ss")); eventLog.WriteToFile(outputDirectory.Value, logFileName.Value + "." + endTime.ToString("MM-dd-yyy-HHmmss") + ".csv"); eventLog.Clear(); + loggingStopped?.Raise(outputFilename); isLogging = false; } } diff --git a/package.json b/package.json index bb1cf649087cc2446c7018fd1abeb602b9047b74..762d08b7cdc2508194b12df6d1b32fc0cbd9086c 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "com.futuretech.shared", "displayName": "FutureTech Shared", "description": "Contains shared items such as the Scriptable Variables.", - "version": "0.1.28", + "version": "0.1.29", "unity": "2019.3", "license": "MIT", "repository": {