LogManager
public class LogManager
{
// Fields
public static bool Debugstate; // Methods
public static void Log(string strText)
{
if (Debugstate)
{
Debug.Log(strText);
}
} public static void Log(string strText, Object context)
{
if (Debugstate)
{
Debug.Log(strText, context);
}
} public static void LogError(string strText)
{
if (Debugstate)
{
Debug.LogError(strText);
}
} public static void LogError(string strText, Object context)
{
if (Debugstate)
{
Debug.LogError(strText, context);
}
} public static void LogWarning(string strText)
{
if (Debugstate)
{
Debug.LogWarning(strText);
}
} public static void LogWarning(string strText, Object context)
{
if (Debugstate)
{
Debug.LogWarning(strText, context);
}
}
}
namespace Kola
{
using System;
using System.IO;
using System.Text;
using UnityEngine; public class KDebugHelp
{
public static bool Enable;
public static bool EnableKConsole; internal KDebugHelp()
{
} public static void Assert(bool flag, string format, params object[] param)
{
if (!flag)
{
PrintError(format, param);
}
} public static void DrawCenterRect(Vector2 center, Vector2 size, float duration, Color color)
{
Vector2 leftTop = new Vector2(center.x - (size.x * 0.5f), center.y + (size.y * 0.5f));
Vector2 rightBottom = new Vector2(center.x + (size.x * 0.5f), center.y - (size.y * 0.5f));
DrawRect(leftTop, rightBottom, duration, color);
} public static void DrawLine(Vector2 start, Vector2 end, float duration, Color color)
{
if (Enable)
{
Debug.DrawLine((Vector3) start, (Vector3) end, color, duration);
}
} public static void DrawPolygon(float duration, Color color, bool close, params Vector2[] pnts)
{
if (Enable && ((pnts != null) && (pnts.Length > )))
{
for (int i = ; i < pnts.Length; i++)
{
DrawLine(pnts[i - ], pnts[i], duration, color);
}
if (close)
{
DrawLine(pnts[pnts.Length - ], pnts[], duration, color);
}
}
} public static void DrawRect(Vector2 leftTop, Vector2 rightBottom, float duration, Color color)
{
if (Enable)
{
DrawLine(new Vector3(leftTop.x, leftTop.y, 0f), new Vector3(rightBottom.x, leftTop.y, 0f), duration, color);
DrawLine(new Vector3(leftTop.x, rightBottom.y, 0f), new Vector3(rightBottom.x, rightBottom.y, 0f), duration, color);
DrawLine(new Vector3(leftTop.x, leftTop.y, 0f), new Vector3(leftTop.x, rightBottom.y, 0f), duration, color);
DrawLine(new Vector3(rightBottom.x, leftTop.y, 0f), new Vector3(rightBottom.x, rightBottom.y, 0f), duration, color);
}
} public static void Error(string msg)
{
WriteLog2File("Error", msg);
if (Enable)
{
if (EnableKConsole)
{
}
Debug.LogError(msg);
}
} public static void Error(string format, params object[] param)
{
Error(string.Format(format, param));
} public static void Log(string msg)
{
if (Enable && !EnableKConsole)
{
Debug.Log(msg);
}
} public static void Log(string format, params object[] param)
{
Log(string.Format(format, param));
} public static void Print(string format, params object[] param)
{
Log(format, param);
} public static void PrintError(string format, params object[] param)
{
Error(format, param);
} public static void PrintWarning(string format, params object[] param)
{
Warning(format, param);
} public static void Warning(string msg)
{
if (Enable)
{
if (EnableKConsole)
{
}
Debug.LogWarning(msg);
}
} public static void Warning(string format, params object[] param)
{
Warning(string.Format(format, param));
} public static void WriteLog2File(string level, string msg)
{
using (FileStream stream = new FileStream(KAssertManager.ExternalPath + "Log.txt", FileMode.Append))
{
string s = string.Format("[{0}] [{1}] [{2}] \n", level, KUtil.GetSystemTime("HH:mm:ss"), msg);
byte[] bytes = Encoding.UTF8.GetBytes(s);
stream.Write(bytes, , bytes.Length);
stream.Flush();
}
}
}
}
LogManager的更多相关文章
- Could not initialize class org.apache.log4j.LogManager 报错
部署项目的时候,在windows下一切正常,但是在centos下就发生如下错误 Caused by: java.lang.ExceptionInInitializerError at com.dsid ...
- Kafka 源代码分析之LogManager
这里分析kafka 0.8.2的LogManager logmanager是kafka用来管理log文件的子系统.源代码文件在log目录下. 这里会逐步分析logmanager的源代码.首先看clas ...
- 解决java log4j 配置log4jCaused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.LogManager
前提安装http://mirror.bit.edu.cn/apache/logging/log4j/2.11.2/apache-log4j-2.11.2-bin.zip Buildpath 配置add ...
- Jafka源码分析——LogManager
在Kafka中,LogManager负责管理broker上全部的Log(每个topic-partition为一个Log). 通过阅读源码可知其详细完毕的功能例如以下: 1. 依照预设规则对消息队列进行 ...
- Jboss:The LogManager was not properly installed (you must set the "java.util.logging.manager" system prop
可能是jboss的服务器版本选择不对 ,比如我本地的Jboss服务器版本是 jboss-as-web-7.0.2.Final,选择的服务器版本是JBOOS V7.1 Runtime ,就会报上面 ...
- .NetCore中的日志(2)集成第三方日志工具
.NetCore中的日志(2)集成第三方日志工具 0x00 在.NetCore的Logging组件中集成NLog 上一篇讨论了.NetCore中日志框架的结构,这一篇讨论一下.NetCore的Logg ...
- python通过protobuf实现rpc
由于项目组现在用的rpc是基于google protobuf rpc协议实现的,所以花了点时间了解下protobuf rpc.rpc对于做分布式系统的人来说肯定不陌生,对于rpc不了解的童鞋可以自行g ...
- kafka源码分析之一server启动分析
0. 关键概念 关键概念 Concepts Function Topic 用于划分Message的逻辑概念,一个Topic可以分布在多个Broker上. Partition 是Kafka中横向扩展和一 ...
- Log4net - 项目使用的一个简单Demo
参考页面: http://www.yuanjiaocheng.net/entity/entitytypes.html http://www.yuanjiaocheng.net/entity/entit ...
随机推荐
- mysql主从怎么样使主为innodb辅为myisam
MySQL主从复制(linux主+windows从) http://blog.csdn.net/qq_20032995/article/details/54380290 mysql主从怎么样使主为in ...
- 自动清空Tomcat日志的办法
cd /usr/local/tomcat7/logs #清空日志 echo > catalina.out vi r.sh #!/bin/sh ########################## ...
- mySQL的存储过程详解
mysql存储过程详解 1. 存储过程简介 我们常用的操作数据库语言SQL语句在执行的时候需要要先编译,然后执行,而存储过程(Stored Procedure)是一组为了完成特定功能的S ...
- MVC模型绑定
在项目中使用MVC的时候,我们无需像WebForm那样手动获取值再赋值到Model上,这得益于MVC的模型绑定,下面就介绍下复杂类型的模型绑定 Controller: public class Hom ...
- notepad++ quicktext插件安装与代码片段配置[quicktext v0.2.1]
1 下载quicktext插件0.2.1版本 http://sourceforge.net/projects/quicktext/ 2 解压 3 把QuickText.ANSI.dll和QuickTe ...
- 曼哈顿距离、欧几里得距离、闵氏距离(p→∞为切比雪夫距离)
曼哈顿距离: 是由十九世纪的赫尔曼·闵可夫斯基所创词汇 ,是种使用在几何度量空间的几何学用语,用以标明两个点在标准坐标系上的绝对轴距总和. 曼哈顿距离——两点在南北方向上的距离加上在东西方向上的距离, ...
- 分享Kali Linux 2017年第29周镜像文件
分享Kali Linux 2017年第29周镜像文件 Kali Linux官方于7月16日发布2017年的第29周镜像.这次维持了11个镜像文件的规模.默认的Gnome桌面的4个镜像,E17.KDE ...
- [CF865C]Gotta Go Fast
题目大意: 一个游戏关卡有$n(n\le50)$个任务,若在$m$秒内按顺序完成所有任务则算作通过当前关卡.每个关卡有三个属性$a_i,b_i,p_i(1\le a_i<b_i\le100,80 ...
- 修复XAMPP安装过程中 因端口80被占用 Apache无法启动的问题
Fix XAMPP Apache Not Starting Because Port 80 In Use XAMPP中Apache服务器无法启动,出现该问题的最常见原因是由于默认端口号80可能已被其他 ...
- Oracle导入本属于sys用户的表
FlashBack Database后,将删除的数据导出时使用了system用户 exp system/oracle file=/home/oracle/test.dmp tables=sys.tes ...