This repository has been archived by the owner on Sep 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
89 additions
and
57 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"NAME":"Pilot Assistant","URL":"https://github.com/Crzyrndm/Pilot-Assistant/blob/master/GameData/Pilot%20Assistant/PilotAssistant.version","DOWNLOAD":"https://github.com/Crzyrndm/Pilot-Assistant/releases","VERSION":{"MAJOR":1,"MINOR":13,"PATCH":2,"BUILD":0},"KSP_VERSION":{"MAJOR":1,"MINOR":2,"PATCH":1},"KSP_VERSION_MIN":{"MAJOR":1,"MINOR":2,"PATCH":1},"KSP_VERSION_MAX":{"MAJOR":1,"MINOR":2,"PATCH":2}} | ||
{"NAME":"Pilot Assistant","URL":"https://github.com/Crzyrndm/Pilot-Assistant/blob/master/GameData/Pilot%20Assistant/PilotAssistant.version","DOWNLOAD":"https://github.com/Crzyrndm/Pilot-Assistant/releases","VERSION":{"MAJOR":1,"MINOR":13,"PATCH":3},"KSP_VERSION":{"MAJOR":1,"MINOR":3,"PATCH":0} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
using System; | ||
using UnityEngine; | ||
|
||
namespace PilotAssistant | ||
{ | ||
internal static class Logger | ||
{ | ||
public static readonly Version version = new Version(1, 13, 3); | ||
|
||
internal enum LogLevel | ||
{ | ||
Debug, | ||
Warn, | ||
Error | ||
} | ||
|
||
/// <summary> | ||
/// format the string to be logged and prefix with mod id + version | ||
/// </summary> | ||
/// <param name="format">string format to be logged</param> | ||
/// <param name="o">params for the format</param> | ||
/// <returns></returns> | ||
static string LogString(string format, params object[] o) | ||
{ | ||
return $"[Pilot Assistant {version}]: {string.Format(format, o)}"; | ||
} | ||
|
||
/// <summary> | ||
/// Debug messages only compiled in debug build. Also much easier to search for once debugging/development complete... | ||
/// </summary> | ||
/// <param name="o"></param> | ||
/// <param name="level"></param> | ||
[System.Diagnostics.Conditional("DEBUG")] | ||
internal static void Dev(object o, LogLevel level = LogLevel.Debug) | ||
{ | ||
Log(o, level); | ||
} | ||
|
||
[System.Diagnostics.Conditional("DEBUG")] | ||
internal static void Dev(string format, LogLevel level = LogLevel.Debug, params object[] o) | ||
{ | ||
Log(format, level, o); | ||
} | ||
|
||
/// <summary> | ||
/// Debug.Log with FE id/version inserted | ||
/// </summary> | ||
/// <param name="o"></param> | ||
internal static void Log(object o, LogLevel level = LogLevel.Debug) | ||
{ | ||
Log(o.ToString(), level); | ||
} | ||
|
||
internal static void Log(string format, LogLevel level = LogLevel.Debug, params object[] o) | ||
{ | ||
if (level == LogLevel.Debug) | ||
{ | ||
Debug.Log(LogString(format, o)); | ||
} | ||
else if (level == LogLevel.Warn) | ||
{ | ||
Debug.LogWarning(LogString(format, o)); | ||
} | ||
else | ||
{ | ||
Debug.LogError(LogString(format, o)); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters