Exemplo n.º 1
0
        public static void SaveLog(string testName, string log)
        {
            if (!Locks.TryGetValue(testName, out var lockObject))
            {
                lockObject = new object();
                if (!Locks.TryAdd(testName, lockObject))
                {
                    lockObject = Locks[testName];
                }
            }

            lock (lockObject)
            {
                var filePath = System.IO.Path.Combine(Path, testName + ".txt");
                Directory.CreateDirectory(Path);
                File.AppendAllLines(filePath, new[] { log });
            }
        }