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. django自带的orm之查询

    一.filter条件查询 用法: 模型类.objects.filter(模型类属性名__查询操作符 = 值) 判等: exact # 例:查询id为1的员工 select * from employe ...

  2. 编译opencv有关cuda的代码

    opencv3.2提供了cuda很好的支持,cuda的opencv接口,让用户想使用opencv那样去使用cuda,不用写cuda代码 一开始编译opencv有关cuda的代码,opencv 里sam ...

  3. RQNOJ PID379 / 约会计划 -并查集

    PID379 / 约会计划 题目描述 cc是个超级帅哥,口才又好,rp极高(这句话似乎降rp),又非常的幽默,所以很多mm都跟他关系不错.然而,最关键的是,cc能够很好的调解各各妹妹间的关系.mm之间 ...

  4. 51nod 1459 迷宫游戏【最短路拓展】

    1459 迷宫游戏 基准时间限制:1 秒 空间限制:131072 KB   你来到一个迷宫前.该迷宫由若干个房间组成,每个房间都有一个得分,第一次进入这个房间,你就可以得到这个分数.还有若干双向道路连 ...

  5. Problem B: 英雄无敌3(2)【模拟,日期转换】

    Problem B: 英雄无敌3(2) Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 295  Solved: 52[Submit][Status][W ...

  6. AtCoder - 2567 RGB Sequence

    Problem Statement There are N squares arranged in a row. The squares are numbered 1, 2, …, N, from l ...

  7. Windows 系统下设置Nodejs NPM全局路径和环境变量配置

    在nodejs的安装目录中找到node_modules\npm\.npmrc文件 修改如下即可: prefix = D:\tool\nodejs\node_globalcache = D:\tool\ ...

  8. python内建datetime模块

    datetime 获取当前日期和时间 from datetime import datetime now = datetime.now() print(now) datetime转换为timestam ...

  9. Android Studio 生成aar包多Module引用问题

    问题描述: 有个arr文件被放到Module A中引用,现在Module B又依赖了Module A,则在编译过程中会发生错误,Module B找不到aar文件. 解决办法: 使用相对路径来找到这个a ...

  10. 使用hsdis查看jit生成的汇编代码

     http://blog.csdn.net/unei66/article/details/26477629 JVM 有 HotSpot引擎可以对热代码路径进行有效的 JIT优化,大幅度提升计算密集代码 ...