スクリプト
使用例
using UnityEngine; public class Example : MonoBehaviour { private readonly CustomLogger m_logger = CustomLogger.Create( "タイトル" ); private void Awake() { m_logger.Log( "Log" ); m_logger.Log( "Log", gameObject ); m_logger.LogWarning( "LogWarning" ); m_logger.LogWarning( "LogWarning", gameObject ); m_logger.LogError( "LogError" ); m_logger.LogError( "LogError", gameObject ); m_logger.LogFormat( "LogFormat {0} / {1}", 1, 2 ); m_logger.LogFormat( gameObject, "LogFormat {0} / {1}", 1, 2 ); m_logger.LogWarningFormat( "LogWarningFormat {0} / {1}", 1, 2 ); m_logger.LogWarningFormat( gameObject, "LogWarningFormat {0} / {1}", 1, 2 ); m_logger.LogErrorFormat( "LogErrorFormat {0} / {1}", 1, 2 ); m_logger.LogErrorFormat( gameObject, "LogErrorFormat {0} / {1}", 1, 2 ); } }
CustomLogger を使用することで Debug.Log にタグを付与することができます
- リリース時は DISABLE_CUSTOM_LOGGER シンボルを無効にすることで
CustomLogger の呼び出しをすべて無効化できます - CustomLogger.DefaultFormat を変更するとタグを付与する際の書式を変更できます
- 「Editor Console Pro」と併用することでタグを使用したフィルタリングが楽になります