From 7c1e566113d59699af1624186c64eca67f063fc6 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Mon, 20 Apr 2020 19:09:33 -0400 Subject: Upgraded Unity --- .../CommandLineTest/LogWriter.cs | 92 ---------------------- 1 file changed, 92 deletions(-) delete mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/LogWriter.cs (limited to 'Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/LogWriter.cs') diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/LogWriter.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/LogWriter.cs deleted file mode 100644 index ba5532e..0000000 --- a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/LogWriter.cs +++ /dev/null @@ -1,92 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using UnityEditor.DeploymentTargets; -using UnityEditor.Utils; -using UnityEngine; - -namespace UnityEditor.TestTools.TestRunner.CommandLineTest -{ - internal class LogWriter : IDisposable - { - private string m_LogsDirectory; - private string m_DeviceID; - private Dictionary m_LogStreams; - private DeploymentTargetLogger m_Logger; - - internal LogWriter(string logsDirectory, string deviceID, DeploymentTargetLogger logger) - { - m_LogStreams = new Dictionary(); - m_Logger = logger; - m_LogsDirectory = logsDirectory; - m_DeviceID = deviceID; - - logger.logMessage += WriteLogToFile; - } - - private void WriteLogToFile(string id, string logLine) - { - StreamWriter logStream; - var streamExists = m_LogStreams.TryGetValue(id, out logStream); - if (!streamExists) - { - var filePath = GetLogFilePath(m_LogsDirectory, m_DeviceID, id); - logStream = CreateLogFile(filePath); - - m_LogStreams.Add(id, logStream); - } - - try - { - if (logLine != null) - logStream.WriteLine(logLine); - } - catch (Exception ex) - { - Debug.LogError($"Writing {id} log failed."); - Debug.LogException(ex); - } - } - - public void Stop() - { - m_Logger.Stop(); - foreach (var logStream in m_LogStreams) - { - logStream.Value.Close(); - } - } - - public void Dispose() - { - Stop(); - } - - private StreamWriter CreateLogFile(string path) - { - Debug.LogFormat(LogType.Log, LogOption.NoStacktrace, null, "Creating {0} device log: {1}", m_DeviceID, path); - StreamWriter streamWriter = null; - try - { - if (!Directory.Exists(path)) - Directory.CreateDirectory(Path.GetDirectoryName(path)); - - streamWriter = File.CreateText(path); - } - catch (Exception ex) - { - Debug.LogError($"Creating device log {path} file failed."); - Debug.LogException(ex); - } - - return streamWriter; - } - - private string GetLogFilePath(string lgosDirectory, string deviceID, string logID) - { - var fileName = "Device-" + deviceID + "-" + logID + ".txt"; - fileName = string.Join("_", fileName.Split(Path.GetInvalidFileNameChars())); - return Paths.Combine(lgosDirectory, fileName); - } - } -} -- cgit v1.2.3