/// <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); }
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()); }