예제 #1
0
        /// <summary>
        /// Logs a line in xbmc.log
        /// </summary>
        /// <param name="message"></param>
        public void Log(string message, XLogLevel level)
        {
            var args = new JObject {
                new JProperty("volume", message), new JProperty("level", level.ToString())
            };

            Client.GetData("XBMC.Log", args, null, null);
        }
예제 #2
0
파일: Logging.cs 프로젝트: peter-tpx/NET
        private string GenerateRowPrefix(XLogInfo pInfoParams, XLogLevel pLevel, string psModule)
        {
            StringBuilder sb = new StringBuilder();


            if ((pInfoParams & XLogInfo.LogDate) == XLogInfo.LogDate)
            {
                sb.AppendFormat("{0:yyyy-MM-dd}", DateTime.Today);
            }

            if ((pInfoParams & XLogInfo.LogTime) == XLogInfo.LogTime)
            {
                if (sb.Length > 0)
                {
                    sb.Append(" ");
                }
                sb.AppendFormat("{0:HH:mm:ss}", DateTime.Now);
            }

            if ((pInfoParams & XLogInfo.LogMSec) == XLogInfo.LogMSec)
            {
                if (sb.Length > 0)
                {
                    sb.Append(".");
                }
                sb.AppendFormat("{0:000}", DateTime.Now.Millisecond);
            }

            if ((pInfoParams & XLogInfo.User) == XLogInfo.User)
            {
                if (sb.Length > 0)
                {
                    sb.Append(" - ");
                }
                sb.AppendFormat("{0:-15}", GetCurrentUserID());
            }

            //TODO -- add session info
            if ((pInfoParams & XLogInfo.Level) == XLogInfo.Level)
            {
                if (sb.Length > 0)
                {
                    sb.AppendFormat(" [{0:-10}]", pLevel.ToString());
                }
                else
                {
                    sb.AppendFormat("{0:-10}", pLevel.ToString());
                }
            }

            if ((pInfoParams & XLogInfo.Module) == XLogInfo.Module)
            {
                if (sb.Length > 0)
                {
                    sb.Append(" - ");
                }
                sb.AppendFormat("{0:-15}", psModule);
            }

            return(sb.ToString());
        }
예제 #3
0
        /// <summary>
        /// Logs a line in xbmc.log
        /// </summary>
        /// <param name="message"></param>
        public void Log(string message, XLogLevel level)
        {
            var args = new JObject { new JProperty("volume", message), new JProperty("level", level.ToString()) };

             Client.GetData("XBMC.Log", args, null, null);
        }