Created
April 25, 2014 10:11
-
-
Save baba-s/11284462 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| using System; | |
| using UnityEngine; | |
| /// <summary> | |
| /// ログに関する汎用関数を管理するクラス | |
| /// </summary> | |
| public static partial class DebugUtils | |
| { | |
| /// <summary> | |
| /// ログを出力します | |
| /// </summary> | |
| public static void Log(string format, params object[] args) | |
| { | |
| Debug.Log(string.Format(format, args)); | |
| } | |
| /// <summary> | |
| /// 指定された条件が false の場合はログを出力します | |
| /// </summary> | |
| public static void Log(bool condition, string format, params object[] args) | |
| { | |
| if (condition) | |
| { | |
| return; | |
| } | |
| Log(format, args); | |
| } | |
| /// <summary> | |
| /// 警告ログを出力します | |
| /// </summary> | |
| public static void Warning(string format, params object[] args) | |
| { | |
| Debug.LogWarning(string.Format(format, args)); | |
| } | |
| /// <summary> | |
| /// 指定された条件が false の場合は警告ログを出力します | |
| /// </summary> | |
| public static void Warning(bool condition, string format, params object[] args) | |
| { | |
| if (condition) | |
| { | |
| return; | |
| } | |
| Warning(format, args); | |
| } | |
| /// <summary> | |
| /// エラーログを出力します | |
| /// </summary> | |
| public static void Error(string format, params object[] args) | |
| { | |
| Debug.LogError(string.Format(format, args)); | |
| } | |
| /// <summary> | |
| /// 指定された条件が false の場合はエラーログを出力します | |
| /// </summary> | |
| public static void Error(bool condition, string format, params object[] args) | |
| { | |
| if (condition) | |
| { | |
| return; | |
| } | |
| Error(format, args); | |
| } | |
| /// <summary> | |
| /// 指定された条件が false の場合は例外を出力します | |
| /// </summary> | |
| public static void Assert(bool condition) | |
| { | |
| if (condition) | |
| { | |
| return; | |
| } | |
| throw new Exception(); | |
| } | |
| /// <summary> | |
| /// 指定された条件が false の場合は例外を出力します | |
| /// </summary> | |
| public static void Assert(bool condition, string format, params object[] args) | |
| { | |
| if (condition) | |
| { | |
| return; | |
| } | |
| throw new Exception(string.Format(format, args)); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment