本文整理汇总了C#中LogType类的典型用法代码示例。如果您正苦于以下问题:C# LogType类的具体用法?C# LogType怎么用?C# LogType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LogType类属于命名空间,在下文中一共展示了LogType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 {
}
}
}
开发者ID:duke1102,项目名称:unity-plus,代码行数:27,代码来源:ErrorReporter.cs
示例2: Log
public void Log(string message, LogType logType, string userUsername)
{
GlobalContext.Properties["LogType"] = logType.ToString();
GlobalContext.Properties["UserUsername"] = userUsername;
log.Info(message);
}
开发者ID:pabloperfalc,项目名称:TallerDiseno,代码行数:7,代码来源:Logger.cs
示例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));
}
}
开发者ID:2ty,项目名称:race3d,代码行数:7,代码来源:UILogHandler.cs
示例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 )
{
}
}
开发者ID:peteward44,项目名称:auto-usb-backup,代码行数:32,代码来源:Log.cs
示例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);
}
}
开发者ID:pouc,项目名称:qv-extension-server,代码行数:7,代码来源:Logging.cs
示例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);
}
}
开发者ID:SteinLabs,项目名称:Mosh_CSharp_Intermediate,代码行数:7,代码来源:FileLogger.cs
示例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));
}
}
}
开发者ID:Awkbak,项目名称:Procrastination,代码行数:32,代码来源:DebugScript.cs
示例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;
}
}
开发者ID:derFunk,项目名称:unity3d-webplayer-jslogger,代码行数:43,代码来源:JavascriptLogger.cs
示例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);
}
}
开发者ID:wooga,项目名称:ps_social_jam,代码行数:7,代码来源:LogCallbackHandler.cs
示例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;
}
开发者ID:wpdu,项目名称:ControlTest,代码行数:26,代码来源:ConsoleLogger.cs
示例11: Write
public void Write(string Message, LogType MessageType)
{
string sAssembly = Assembly.GetCallingAssembly().FullName;
string sMethod = qualifiedObjName();
this.Write(sAssembly, sMethod, Message, MessageType);
}
开发者ID:gbarnes12,项目名称:atlantis-xna,代码行数:7,代码来源:Logger.cs
示例12: LogAsync
public Task<bool> LogAsync(LogType type, string message)
{
var messageToLog = GetMessage(type, message);
System.Diagnostics.Debug.WriteLine(messageToLog);
return Task.FromResult(true);
}
开发者ID:wpdu,项目名称:ControlTest,代码行数:7,代码来源:ConsoleLogger.cs
示例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));
}
开发者ID:icaca,项目名称:boogiebot,代码行数:8,代码来源:Program.cs
示例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);
}
}
开发者ID:junaid-git,项目名称:TicketAllocater,代码行数:28,代码来源:TraceLogger.cs
示例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;
}
}
开发者ID:Tarique-se,项目名称:Archives,代码行数:28,代码来源:ObjectExtensions.cs
示例16: Write
public static void Write(LogType lt, string location, string message)
{
switch (lt)
{
case LogType.ERROR:
Console.ForegroundColor = ConsoleColor.Red;
Console.Write("[" + location + "] ");
Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine(message);
break;
case LogType.MESSAGE:
Console.ForegroundColor = ConsoleColor.Green;
Console.Write("[" + location + "] ");
Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine(message);
break;
case LogType.WARNING:
Console.ForegroundColor = ConsoleColor.Yellow;
Console.Write("[" + location + "] ");
Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine(message);
break;
}
}
开发者ID:BryceGough,项目名称:MapleSharp,代码行数:27,代码来源:MapleConsole.cs
示例17: Log
public static void Log(string data, LogType type, bool writeToConsole)
{
string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\NJournals\\logs";
DirectoryInfo di = new DirectoryInfo(path);
if (!di.Exists) {
di.Create();
}
if (writeToConsole) {
Console.WriteLine(data);
}
using (StreamWriter sw = new StreamWriter(path + "\\NJournals" + DateTime.Now.ToString("MM-dd-yy") + ".log", true)) {
sw.WriteLine("[" + type.ToString() + "] " + data);
/*if (type != LogType.INFO &&
type != LogType.WARNING &&
type != LogType.ERR){
sw.WriteLine("[" + type.ToString() + "] " + data);
} else {
sw.WriteLine(data);
}*/
}
}
开发者ID:ProximaCentauri,项目名称:pointofsale,代码行数:25,代码来源:LogHelper.cs
示例18: Log
public void Log( LogType type, string message )
{
if( type == LogType.Error ) {
Console.Write( DateTime.Now.ToString( LogTimeFormat ) + " > " );
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine( "ERROR: " + message );
Console.ForegroundColor = defaultCol;
} else if( type == LogType.Warning ) {
Console.Write( DateTime.Now.ToString( LogTimeFormat ) + " > " );
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine( "Warning: " + message );
Console.ForegroundColor = defaultCol;
} else if( type == LogType.BotActivity ) {
Console.Write( DateTime.Now.ToString( LogTimeFormat ) + " > " );
Console.ForegroundColor = ConsoleColor.DarkGray;
Console.WriteLine( message );
Console.ForegroundColor = defaultCol;
} else if( type == LogType.Chat ) {
Console.Write( DateTime.Now.ToString( LogTimeFormat ) + " > " );
AppendChat( message );
}
#if DEBUG
else if( type == LogType.Debug ) {
Console.Write( DateTime.Now.ToString( LogTimeFormat ) + " > " );
Console.WriteLine( "DEBUG: " + message );
}
#endif
}
开发者ID:Grivaryg,项目名称:LibClassicBot,代码行数:28,代码来源:Loggers.cs
示例19: Write
/// <summary>
/// Write a message log
/// </summary>
/// <param name="logType">Value of LogType</param>
/// <param name="message">Message to log</param>
/// <param name="messageId">Id of the message</param>
/// <remarks>
/// The message is completed with some information like:
/// Date/time
/// Url and UserAgent if available
/// </remarks>
public override void Write(LogType logType, string message, int messageId)
{
base.Write(logType, message, messageId);
message = EnrichMessage(message);
WriteTrace(logType, message, messageId);
}
开发者ID:DeLeneMirouze,项目名称:SuperLog,代码行数:18,代码来源:TraceLogAdapter.cs
示例20: Write
public void Write(string logfilename, string log, LogType lt)
{
#if UNITY_IPHONE || UNITY_ANDROID
return;
#endif
string filePathName = WriteFile(logfilename);
FileStream fs = new FileStream(filePathName, FileMode.Append);
StreamWriter sw = new StreamWriter(fs);
//开始写入
sw.WriteLine("");
//
string str = "[";
str += System.DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");//默认当天时间。
str += "]";
str += "\t";
str += lt.ToString();
str += "\t";
str += log;
sw.Write(str);
//清空缓冲区
sw.Flush();
//关闭流
sw.Close();
fs.Close();
}
开发者ID:seenen,项目名称:Tool_AssetBundles,代码行数:27,代码来源:LogFile.cs
注:本文中的LogType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论