集成Log4Net到自己的Unity工程
需要使用的插件库说明:
Loxodon Framework Log4Net
Version: 1.0.0
© 2016, Clark Yang
=======================================
Thank you for purchasing the plugin!
I hope you enjoy using the product and that it makes your game development faster and easier.
If you have a moment,please leave me a review on the Asset Store.
The version is compatible with MacOSX,Windows,Linux iOS and Android etc.
Requires Loxodon Framework.
https://www.assetstore.unity3d.com/#!/content/77446
Please email yangpc.china@gmail.com for any help or issues.
UPDATE NOTES
----------------------------------------
参考Log4NetExample扩展自己的Loger:
using System.IO;
using Loxodon.Log;
using UnityEngine; public sealed class ZSLoger
{
static private ZSLoger _instance;
static public ZSLoger Instance
{
get
{
if (_instance == null)
{
_instance = new ZSLoger();
}
return _instance;
}
} private ZSLoger()
{
InitializeLog();
} private void InitializeLog()
{
/* Initialize the log4net */
TextAsset configText = Resources.Load<TextAsset>("Log4NetConfig");
if (configText != null)
{
using (MemoryStream memStream = new MemoryStream(configText.bytes))
{
log4net.Config.XmlConfigurator.Configure(memStream);
}
} /* Initialize the Loxodon.Log.LogManager */
LogManager.Registry(new Log4NetFactory());
} public ILog Loger
{
get
{
return LogManager.GetLogger(typeof(ZSLoger));
}
}
}
使用情况:
...
public virtual void Enter()
{
ZSLoger.Instance.Loger.Debug("this is a test, in enter.");
} public virtual void Exit()
{ } public virtual void Update()
{ }
}
...
using System.Collections;
using System.Collections.Generic;
using UnityEngine; public class RunLogicManager : SingletonLimit<RunLogicManager>
{
private RunningBaseState mState;
private Stack<RunningBaseState> mStateStack = new Stack<RunningBaseState>(); public static RunLogicManager Instance
{
get
{
return (RunLogicManager)mInstance;
}
set
{
mInstance = value;
}
} private void GotoState(RunningBaseState state)
{
if (mStateStack.Count > )
{
var tempState = mStateStack.Pop();
tempState.Exit();
}
mState = state;
mStateStack.Push(mState);
mState.Enter();
} // Use this for initialization
void Start ()
{
GotoState(RunningBaseState.time);
} // Update is called once per frame
void Update ()
{ }
}
// 输出情况
-- ::, Thread[] DEBUG ZSLoger - this is a test, in enter.
集成Log4Net到自己的Unity工程的更多相关文章
- unity工程接入Android sdk后真机测试解锁屏后退出的解决
unity工程接入如91.移动支付等Android sdk后,真机运行尤其是在4.0+以上坏境,往往会出现解锁屏后退出的情况,解决办法如下: 可以在AndroidManifest.xml中所有的con ...
- 用Visual Studio创建集成了gtest的命令行工程
gtest代码库中的sample代码 在gtest的代码库中,包含了10个sample的代码,覆盖了gtest的常见用法,sample的代码位于以下文件夹: gtest\samples 由于gtest ...
- asp.net core 集成 log4net 日志框架
asp.net core 集成 log4net 日志框架 Intro 在 asp.net core 中有些日志我们可能想输出到数据库或文件或elasticsearch等,如果不自己去实现一个 Logg ...
- 【Unity_UWP】Unity 工程发布win10 UWP 时的本地文件读取 (下篇)
Universal Windows Platform(UWP)是微软Windows10专用的通用应用平台,其目的在于在统一操作系统下控制所有智能电子设备. 自从Unity 5.2之后,配合VS 201 ...
- 【Unity_UWP】Unity 工程发布win10 UWP 时的本地文件读取 (上篇)
Universal Windows Platform(UWP)是微软Windows10专用的通用应用平台,其目的在于在统一操作系统下控制所有智能电子设备. 自从Unity 5.2之后,配合VS 201 ...
- 升级MAC OS到10.13, 10.14系统后UNITY工程无法加载资源的解决办法
升级MAC OS到10.13, 10.14系统后,出现UNITY工程无法加载资源的情况: Unity项目中Asset目录显示为空! 解决办法一: 打开Launchpad中的磁盘工具 (也就是实用工具下 ...
- Unity工程资源破解
Unity工程资源提取其实还是很方便的,网上也有很多相关介绍,比如雨凇就专门写了一遍关于破解Unity资源的文章(http://www.xuanyusong.com/archives/3618 ...
- Asp.Net Core 进阶(二) —— 集成Log4net
Asp.Net Core 支持适用于各种内置日志记录API,同时也支持其他第三方日志记录.在我们新建项目后,在Program 文件入口调用了CreateDefaultBuilder,该操作默认将添加以 ...
- Unity工程无代码化
目的 Unity默认是将代码放入工程,这样容易带来一些问题.1. 代码和资源混合,职能之间容易互相误改.2. 当代码量膨胀到一定程度后,代码的编译时间长到无法忍受.新版的unity支持通过asmde ...
随机推荐
- C++文件读写demo
一.常用文件打开方式 二.读写文件步骤(文本文件) 1.写文件步骤 1)#include <fstream> //包含头文件 2)ofstream ofs; //创建流对象 3)ofs.o ...
- Centos 7 firewall的防火墙的规则
这是官方文档: http://www.firewalld.org/documentation/man-pages/firewall-cmd.html 想使用iptables的规则,firewall也可 ...
- 取Cookie值
string url_Login_Group = "http://ui.ptlogin2.qq.com/cgi-bin/login?appid=549000912&daid=5&am ...
- Python 文件&异常 初学者笔记
文件 读取整个文件 with open('pi_30_digits.txt') as file_object :#Python在当前执行文件目录寻找指定文件#filename = 文件的绝对路径或相对 ...
- Hadoop学习之路(9)ZooKeeper安装
文章目录 1.环境准备 1.1下载zooKeeper 1.3安装zooKeeper 1.4配置zooKeeper环境变量 1.5 修改zookeeper集群配置文件 1.6 创建myid文件 1.7 ...
- C语言 三目运算
C语言 三目运算 功能:为真后可根据条件选择成立两个不同的表达式 如果表达式1值为真选择表达式2 如果表达式1值为假选择表达式3 案例 #define _CRT_SECURE_NO_WARNINGS ...
- Hibernate + mysql 配置
1.生成po的配置 2.连接 MySQL 数据库的配合
- 2级搭建类EM-Oracle EMCC 13c Release 3 在 OEL 7.7 上的搭建
Oracle Enterprise Manager Cloud Control 13c Release 3 (13.3.0.0) 安装
- 远程执行命令_python
一.远程执行命令模块subprocess Python可以使用subprocess下的Popen类中的封装的方法来执行命令 构造方法 popen() 创建popen类的实例化对象 ··· obj = ...
- SQLserver中存储图片
两种方式1.存放图片路径2.转换成2进制流(不过这样的话将很占用数据库空间)存路径的方式就很简单了,下面着重给出转换成2进制流的存入以及读取方法.存入:string FilePath="&q ...