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的更多相关文章

  1. Could not initialize class org.apache.log4j.LogManager 报错

    部署项目的时候,在windows下一切正常,但是在centos下就发生如下错误 Caused by: java.lang.ExceptionInInitializerError at com.dsid ...

  2. Kafka 源代码分析之LogManager

    这里分析kafka 0.8.2的LogManager logmanager是kafka用来管理log文件的子系统.源代码文件在log目录下. 这里会逐步分析logmanager的源代码.首先看clas ...

  3. 解决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 ...

  4. Jafka源码分析——LogManager

    在Kafka中,LogManager负责管理broker上全部的Log(每个topic-partition为一个Log). 通过阅读源码可知其详细完毕的功能例如以下: 1. 依照预设规则对消息队列进行 ...

  5. 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 ,就会报上面 ...

  6. .NetCore中的日志(2)集成第三方日志工具

    .NetCore中的日志(2)集成第三方日志工具 0x00 在.NetCore的Logging组件中集成NLog 上一篇讨论了.NetCore中日志框架的结构,这一篇讨论一下.NetCore的Logg ...

  7. python通过protobuf实现rpc

    由于项目组现在用的rpc是基于google protobuf rpc协议实现的,所以花了点时间了解下protobuf rpc.rpc对于做分布式系统的人来说肯定不陌生,对于rpc不了解的童鞋可以自行g ...

  8. kafka源码分析之一server启动分析

    0. 关键概念 关键概念 Concepts Function Topic 用于划分Message的逻辑概念,一个Topic可以分布在多个Broker上. Partition 是Kafka中横向扩展和一 ...

  9. Log4net - 项目使用的一个简单Demo

    参考页面: http://www.yuanjiaocheng.net/entity/entitytypes.html http://www.yuanjiaocheng.net/entity/entit ...

随机推荐

  1. [BZOJ2049][Sdoi2008]Cave 洞穴勘测 LCT模板

    2049: [Sdoi2008]Cave 洞穴勘测 Time Limit: 10 Sec  Memory Limit: 259 MBSubmit: 9705  Solved: 4674[Submit] ...

  2. C#实现HTML转图片(网页快照)

    有时候我们需要将网页转成图片,那么可以使用WebBrowser来生成网页快照,废话不多说,代码如下 1.网页快照帮助类(如果是BS或控制台需要引用System.Windows.Forms类库): pu ...

  3. (寒假GYM开黑)2018-2019 ACM-ICPC Nordic Collegiate Programming Contest (NCPC 2018)

    layout: post title: 2018-2019 ACM-ICPC Nordic Collegiate Programming Contest (NCPC 2018) author: &qu ...

  4. The 15th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple - L Doki Doki Literature Club

    Doki Doki Literature Club Time Limit: 1 Second      Memory Limit: 65536 KB Doki Doki Literature Club ...

  5. 51nod 编辑距离问题(动态规划)

    编辑距离问题 给定两个字符串S和T,对于T我们允许三种操作:(1) 在任意位置添加任意字符(2) 删除存在的任意字符(3) 修改任意字符 问最少操作多少次可以把字符串T变成S? 例如: S=  “AB ...

  6. 20、Django实战第20天:课程详情页

    1.把course-detail.html复制到templates目录下 2.编辑course-detail.html,分析页面,继承base.html 3.编辑courses.views .... ...

  7. 【对询问分块】【主席树】bzoj2683 简单题

    对操作序列分块,每S次暴力重建主席树. 当S=sqrt(n*log(n))时,复杂度为O(m*sqrt(n*log(n))). 在线的. #include<cstdio> #include ...

  8. 数列求和 Exercise06_13

    /** * @author 冰樱梦 * 时间:2018年下半年 * 题目:数列求和 * */ public class Exercise06_13 { public static void main( ...

  9. Java杂谈2——引用与跟搜索算法

    Java中的引用 Java“引用”的概念源于C++,原本的定义相当有限:一个引用(Reference)代表的内存通常用于指向另一块内存区域的起始地址.通过引用类型保存的起始地址,可以找到这个引用所指向 ...

  10. Hadoop学习入门

    1.hadoop相关术语 HDFS: Hadoop分布式文件系统(HDFS,Hadoop Distributed Filesystem) MapReduce: NameNode: DataNode: ...