本文整理汇总了C#中LogType类的典型用法代码示例。如果您正苦于以下问题:C# LogType类的具体用法?C# LogType怎么用?C# LogType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LogType类属于命名空间,在下文中一共展示了LogType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LogCallback
private static void LogCallback(string message, string trace, LogType type)
{
if (System.Array.IndexOf(logTypes, type) != -1) {
string supportData = null;
try {
if (collectSupportData != null) {
supportData = collectSupportData();
}
}
catch {
}
try {
var form = new WWWForm();
form.AddField("application", SafeString(appName));
form.AddField("version", SafeString(version));
form.AddField("userData", SafeString(userData));
form.AddField("supportData", SafeString(supportData));
form.AddField("userId", SafeString(userId));
form.AddField("message", SafeString(message));
form.AddField("trace", SafeString(trace));
new WWW(uri, form.data);
}
catch {
}
}
}
示例2: Log
public void Log(string message, LogType logType, string userUsername)
{
GlobalContext.Properties["LogType"] = logType.ToString();
GlobalContext.Properties["UserUsername"] = userUsername;
log.Info(message);
}
示例3: LogFormat
public void LogFormat(LogType logType, UnityEngine.Object context, string format, params object[] args)
{
Debug.logger.logHandler.LogFormat(logType, context, format, args);
if (UILogView.sInstance != null) {
UILogView.sInstance.AddLog (string.Format (format, args));
}
}
示例4: WriteLine
public static void WriteLine( LogType logType, string line )
{
try
{
LogType textLogVerboseFlag = sVerboseEnabled ? LogType.TextLogVerbose : (LogType)0;
DateTime now = DateTime.Now;
string dateLine = string.Format( "[{0} {1:d2}{2:d2}{3:d2}] {4}", now.ToShortDateString(), now.Hour, now.Minute, now.Second, line );
if ( ( logType & ( LogType.AppLog | LogType.Error ) ) > 0 )
GUI.MainForm.Instance.LogBox.WriteLine( now, line, ( ( logType & LogType.Error ) > 0 ) ? System.Drawing.Color.Red : System.Drawing.Color.Black );
if ( (logType & ( LogType.DebugLog | LogType.Error | textLogVerboseFlag ) ) > 0 )
System.Diagnostics.Debug.WriteLine( dateLine );
if ( (logType & ( LogType.TextLog | LogType.Error | textLogVerboseFlag ) ) > 0 )
{
ReloadLogFile();
if ( mFileLog != null )
{
mFileLog.WriteLine( dateLine );
mFileLog.Flush();
}
}
if ( LogLineEvent != null )
LogLineEvent( line );
}
catch ( System.Exception )
{
}
}
示例5: log
public void log(string msg, int lvl, LoggingException e, LogType l, params Object[] p)
{
if (lvl <= this._maxLvl)
{
Logging.logStream(Console.Out, msg, lvl, e, l, p);
}
}
示例6: Log
void Log (LogType type, string message)
{
using (var streamWriter = new StreamWriter(dir + _name, true))
{
streamWriter.WriteLine(DateTime.Now.ToLongTimeString() + " | " + type.ToString().ToUpper() + " | " + message);
}
}
示例7: handleLog
/// <summary>
/// Handles captured messages from the debug console
/// </summary>
/// <param name="logString">The message displayed</param>
/// <param name="stackTrace">Stack trace of where the message occured (Mainly used with error and exception messaged)</param>
/// <param name="type">What kind of message (Log, Warning, Warning, Error, Exception, Assert)</param>
private void handleLog(string logString, string stackTrace, LogType type)
{
//If it's a log, just output it
if (type.Equals(LogType.Log))
{
println(logString);
}//If it's a warning, include that type (Warning)
else if(type.Equals(LogType.Warning))
{
println(type + ": " + logString);
}//Otherwise, it is serious and output the type, log, and stacktrace
else
{
//Wrapping lines messes up the console
//This curbs it a bit, but still allows for some stack output
//Since in an error, reading what's wrong is most important
if (stackTrace.Length < 250)
{
println(type + ": " + logString + " " + stackTrace);
}
else
{
println(type + ": " + logString + " " + stackTrace.Substring(0, 250));
}
}
}
示例8: HandleUnityLog
/// <summary>
/// Handles the standard unity log output.
/// </summary>
/// <param name='logString'>
/// Log string.
/// </param>
/// <param name='stackTrace'>
/// Stack trace.
/// </param>
/// <param name='type'>
/// Type.
/// </param>
public void HandleUnityLog(string logString, string stackTrace, LogType type)
{
if (stackTrace == null)
stackTrace = "(null)";
if (logString == null)
logString = "(null)";
switch(type)
{
case LogType.Log:
_log(logString, "Unity3D.Debug.Log", "DEBUG");
break;
case LogType.Warning:
_log(logString, "Unity3D.Debug.LogWarning", "WARN");
break;
case LogType.Error:
_log(logString, "Unity3D.Debug.LogError", "ERROR");
break;
case LogType.Exception:
_log(logString + ": " + stackTrace, "Unity3D.Debug.LogException", "FATAL");
break;
case LogType.Assert:
_log(logString, "Unity3D.Debug.LogAssert", "INFO");
break;
default:
_log(logString, "Unity3D.Debug.Log", "INFO");
break;
}
}
示例9: HandleLog
private static void HandleLog(string condition, string stackTrace, LogType type)
{
for (var i = 0; i < _callbacks.Count; ++i)
{
_callbacks[i](condition, stackTrace, type);
}
}
示例10: GetMessage
private static string GetMessage(LogType type, string message, Exception exception = null)
{
string messageToLog = string.Empty;
if (exception != null)
{
messageToLog = string.Format(LogMessageException,
GetTimeStamp(),
type.ToString(),
message,
exception.GetType(),
exception.Message,
(exception.InnerException != null && exception.InnerException.Message != null) ? exception.InnerException.Message : "None",
exception.Source
);
}
else
{
messageToLog = string.Format(LogMessageBrief,
GetTimeStamp(),
type.ToString(),
message
);
}
return messageToLog;
}
示例11: Write
public void Write(string Message, LogType MessageType)
{
string sAssembly = Assembly.GetCallingAssembly().FullName;
string sMethod = qualifiedObjName();
this.Write(sAssembly, sMethod, Message, MessageType);
}
示例12: LogAsync
public Task<bool> LogAsync(LogType type, string message)
{
var messageToLog = GetMessage(type, message);
System.Diagnostics.Debug.WriteLine(messageToLog);
return Task.FromResult(true);
}
示例13: Log
// Log Handler
public static void Log(LogType lt, string format, params object[] parameters)
{
if (bot.InvokeRequired)
bot.Invoke(new LogInvoke(Log), new object[] { lt, format, parameters });
else
bot.Log(lt, String.Format(format, parameters));
}
示例14: LogTrace
public static void LogTrace(LogType logType, string message, params object[] args)
{
try
{
switch (logType)
{
case LogType.Debug:
log.DebugFormat(message, args);
break;
case LogType.Error:
log.ErrorFormat(message, args);
break;
case LogType.Fatal:
log.FatalFormat(message, args);
break;
case LogType.Info:
log.InfoFormat(message, args);
break;
case LogType.Warn:
log.WarnFormat(message, args);
break;
}
}
catch (Exception e)
{
log.WarnFormat(e.Message);
}
}
示例15: Log
public static void Log(this object e, string logMessage = "", LogType type = LogType.SystemLog, string defaultSchema = "system", int severityLevel = 0)
{
if (_logSeverityLevel == -1) _logSeverityLevel = new AppConfig<ApplicationConfiguration>().GetConfigValue<int>("LogSeverityLevel");
if ((e as Exception) != null) type = LogType.ExceptionLog;
else if ((e as string) != null) logMessage += e;
if (severityLevel > _logSeverityLevel) return;
logMessage = logMessage.Replace("'", "''");
switch (type)
{
case LogType.ExceptionLog:
var innerException = (Exception)e;
logMessage += innerException.Message;
while (innerException.InnerException != null)
{
logMessage += innerException.Message;
innerException = innerException.InnerException;
}
AppLogger.Error(logMessage);
break;
case LogType.SystemLog:
AppLogger.Info(logMessage);
break;
case LogType.ScheduledLog:
DAL.DefaultDb.ExecuteNonQuery(CommandType.Text, string.Format(Resources.Resources.LogScript_sql, defaultSchema, (int)type, logMessage));
AppLogger.Info(logMessage);
break;
}
}