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. PLSQL Developer 运用Profiler 分析存储过程性能

    最近应公司需要,需要编写ORACLE存储过程.本人新手,在完成存储过程的编写后,感觉需要对存储过程中各个语句的执行时间进行分析,以便 对整个存储过程进行优化. 由于用的是PLSQL Developer ...

  2. 使用pipeline管道执行redis命令

    pipeline管道可以减少后端与redis的连接次数,从而实现了优化. 原理如下: 使用方法: 未使用pipeline前: strict_redis = get_redis_connection(' ...

  3. resin + eclipse 遇到的问题

    1. 编译jsp报错: com.caucho.jsp.JspParseException: javac compiler is not available in Java(TM) SE Runtime ...

  4. Java中导入导出Excel -- POI技术

    一.介绍: 当前B/S模式已成为应用开发的主流,而在企业办公系统中,常常有客户这样子要求:你要把我们的报表直接用Excel打开(电信系统.银行系统).或者是:我们已经习惯用Excel打印.这样在我们实 ...

  5. AtCoder Grand Contest 023 A - Zero-Sum Ranges

    Time limit : 2sec / Memory limit : 256MB Score : 200 points Problem Statement We have an integer seq ...

  6. Jenkins使用SSH远程发布

    远程发布需要安装Publish Over SSH插件 比如我们的应用服务器都是通过tomcat用户启动程序,因此,在jenkin服务器上配置免密登录远程服务器tomcat用户 //生成密钥对 ssh- ...

  7. [Luogu P4198]楼房重建(线段树)

    题目描述 小A的楼房外有一大片施工工地,工地上有N栋待建的楼房.每天,这片工地上的房子拆了又建.建了又拆.他经常无聊地看着窗外发呆,数自己能够看到多少栋房子. 为了简化问题,我们考虑这些事件发生在一个 ...

  8. [SPOJ]COT2

    题意:给一棵带点权的树,多次询问两点间路径上的不同权值数 学习了一下莫队上树(雾 先求出栈入栈序$p_{1\cdots 2n}$,记$st_x$为$x$在$p$中第一次出现的位置,$ed_x$为$x$ ...

  9. angularjs+requirejs整合

    通过requirejs的配置让angularJS可以正常运行.以下是配置的步骤: 环境需求 require.js angular.js 有了这两文件,就可以进行下一步了,具体将文件放到哪个目录,可以跟 ...

  10. IO多路复用 select、poll、epoll

    什么是IO多路复用 在同一个线程里面, 通过拨开关的方式,来同时传输多个(socket)I/O流. 在英文中叫I/O multiplexing.这里面的 multiplexing 指的其实是在单个线程 ...