mirror of
https://github.com/drewcassidy/KSP-Conformal-Decals.git
synced 2024-09-01 18:23:54 +00:00
Black Lives Matter
This commit is contained in:
23
Source/ConformalDecals/Util/Logging.cs
Normal file
23
Source/ConformalDecals/Util/Logging.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ConformalDecals.Util {
|
||||
public static class Logging {
|
||||
public static void Log(this PartModule module, string message) => Debug.Log(FormatMessage(module, message));
|
||||
|
||||
public static void LogWarning(this PartModule module, string message) =>
|
||||
Debug.LogWarning(FormatMessage(module, message));
|
||||
|
||||
public static void LogError(this PartModule module, string message) =>
|
||||
Debug.LogError(FormatMessage(module, message));
|
||||
|
||||
public static void LogException(this PartModule module, string message, Exception exception) =>
|
||||
Debug.LogException(new Exception(FormatMessage(module, message), exception));
|
||||
|
||||
|
||||
private static string FormatMessage(PartModule module, string message) =>
|
||||
$"[{GetPartName(module.part)} {module.GetType()}] {message}";
|
||||
|
||||
private static string GetPartName(Part part) => part.partInfo?.name ?? part.name;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user