コード例 #1
0
        private static void Log(string msg, LogChannel channel, LogLvl level)
        {
            // cease log that we do not want
            if ((int)level < (int)minimumLvl || !LogChannels.IsChannelActive(channel))
            {
                return;
            }

            string channelStr = LogChannels.GetChannelName(channel);
            string finalMsg   = string.Format("[ {0} ] - {1}", channelStr, msg);

            switch (level)
            {
            case LogLvl.Info:
                Debug.Log(finalMsg);
                break;

            case LogLvl.Warning:
                Debug.LogWarning(finalMsg);
                break;

            case LogLvl.Error:
                Debug.LogError(finalMsg);
                break;

            case LogLvl.Assertion:
                Debug.LogAssertion(finalMsg);
                break;

            case LogLvl.Exception:
                // TODO: Implementation
                break;

            default:
                Debug.LogFormat("The log level {0} does not exist", level.ToString());
                break;
            }
        }
コード例 #2
0
ファイル: Log.cs プロジェクト: boxsie/BoxsieApp
 private static string CreateMessage(string message, LogLvl lvl = LogLvl.Debug)
 {
     return($"[{DateTime.Now:T}][{lvl.ToString()[0]}]:{message}");
 }