Merge pull request #37 from onerain88/ci
chore: namespace
commit
638c43c4a2
|
@ -328,3 +328,5 @@ ASALocalRun/
|
|||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
||||
|
||||
!Common/Log/
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
namespace LeanCloud.Common {
|
||||
/// <summary>
|
||||
/// 日志级别
|
||||
/// </summary>
|
||||
public enum LogLevel {
|
||||
/// <summary>
|
||||
/// 调试级别
|
||||
/// </summary>
|
||||
Debug,
|
||||
/// <summary>
|
||||
/// 警告级别
|
||||
/// </summary>
|
||||
Warn,
|
||||
/// <summary>
|
||||
/// 错误级别
|
||||
/// </summary>
|
||||
Error,
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
|
||||
namespace LeanCloud.Common {
|
||||
/// <summary>
|
||||
/// 日志类
|
||||
/// </summary>
|
||||
public static class Logger {
|
||||
/// <summary>
|
||||
/// 日志回调接口,方便开发者调试
|
||||
/// </summary>
|
||||
/// <value>The log delegate.</value>
|
||||
public static Action<LogLevel, string> LogDelegate {
|
||||
get; set;
|
||||
}
|
||||
|
||||
public static void Debug(string log) {
|
||||
LogDelegate?.Invoke(LogLevel.Debug, log);
|
||||
}
|
||||
|
||||
public static void Debug(string format, params object[] args) {
|
||||
LogDelegate?.Invoke(LogLevel.Debug, string.Format(format, args));
|
||||
}
|
||||
|
||||
public static void Warn(string log) {
|
||||
LogDelegate?.Invoke(LogLevel.Warn, log);
|
||||
}
|
||||
|
||||
public static void Warn(string format, params object[] args) {
|
||||
LogDelegate?.Invoke(LogLevel.Warn, string.Format(format, args));
|
||||
}
|
||||
|
||||
public static void Error(string log) {
|
||||
LogDelegate?.Invoke(LogLevel.Error, log);
|
||||
}
|
||||
|
||||
public static void Error(string format, params object[] args) {
|
||||
LogDelegate?.Invoke(LogLevel.Error, string.Format(format, args));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,15 +5,15 @@ using LeanCloud.Common;
|
|||
|
||||
namespace Common.Test {
|
||||
public class AppRouterTest {
|
||||
static void Print(LeanCloud.LogLevel level, string info) {
|
||||
static void Print(LogLevel level, string info) {
|
||||
switch (level) {
|
||||
case LeanCloud.LogLevel.Debug:
|
||||
case LogLevel.Debug:
|
||||
TestContext.Out.WriteLine($"[DEBUG] {info}");
|
||||
break;
|
||||
case LeanCloud.LogLevel.Warn:
|
||||
case LogLevel.Warn:
|
||||
TestContext.Out.WriteLine($"[WARNING] {info}");
|
||||
break;
|
||||
case LeanCloud.LogLevel.Error:
|
||||
case LogLevel.Error:
|
||||
TestContext.Out.WriteLine($"[ERROR] {info}");
|
||||
break;
|
||||
default:
|
||||
|
@ -24,12 +24,12 @@ namespace Common.Test {
|
|||
|
||||
[SetUp]
|
||||
public void SetUp() {
|
||||
LeanCloud.Logger.LogDelegate += Print;
|
||||
Logger.LogDelegate += Print;
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown() {
|
||||
LeanCloud.Logger.LogDelegate -= Print;
|
||||
Logger.LogDelegate -= Print;
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using NUnit.Framework;
|
||||
using System.Threading.Tasks;
|
||||
using LeanCloud.Storage;
|
||||
using LeanCloud.Common;
|
||||
|
||||
namespace LeanCloud.Test {
|
||||
public class ACLTest {
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Threading.Tasks;
|
||||
using System.Linq;
|
||||
using LeanCloud.Storage;
|
||||
using LeanCloud.Common;
|
||||
|
||||
namespace LeanCloud.Test {
|
||||
public class CloudTest {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using NUnit.Framework;
|
||||
using LeanCloud.Storage;
|
||||
using LeanCloud.Common;
|
||||
|
||||
namespace LeanCloud.Test {
|
||||
public class ExceptionTest {
|
||||
|
|
|
@ -3,6 +3,7 @@ using System;
|
|||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using LeanCloud.Storage;
|
||||
using LeanCloud.Common;
|
||||
|
||||
namespace LeanCloud.Test {
|
||||
public class FileTest {
|
||||
|
|
|
@ -3,6 +3,7 @@ using System;
|
|||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using LeanCloud.Storage;
|
||||
using LeanCloud.Common;
|
||||
|
||||
namespace LeanCloud.Test {
|
||||
public class ObjectTest {
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using LeanCloud.Storage;
|
||||
using LeanCloud.Common;
|
||||
|
||||
namespace LeanCloud.Test {
|
||||
public class OperationTest {
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using LeanCloud.Storage;
|
||||
using LeanCloud.Common;
|
||||
|
||||
namespace LeanCloud.Test {
|
||||
public class QueryTest {
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.Threading.Tasks;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using LeanCloud.Storage;
|
||||
using LeanCloud.Common;
|
||||
|
||||
namespace LeanCloud.Test {
|
||||
public class RelationTest {
|
||||
|
|
|
@ -4,6 +4,7 @@ using System.Collections.Generic;
|
|||
using System.Threading.Tasks;
|
||||
using System.Linq;
|
||||
using LeanCloud.Storage;
|
||||
using LeanCloud.Common;
|
||||
|
||||
namespace LeanCloud.Test {
|
||||
[TestFixture]
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using LeanCloud.Storage;
|
||||
using LeanCloud.Common;
|
||||
|
||||
namespace LeanCloud.Test {
|
||||
internal class Hello : LCObject {
|
||||
|
|
|
@ -3,6 +3,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using LeanCloud.Storage;
|
||||
using LeanCloud.Common;
|
||||
|
||||
namespace LeanCloud.Test {
|
||||
public class UserTest {
|
||||
|
|
Loading…
Reference in New Issue