集成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 ...
随机推荐
- Enable VT-x in your BIOS security settings, ensure that HAXM is installed properly. Try disabling 3rd party security software if the problem still occurs
win7系统安装了了AndroidStudio3.5后用模拟器报错:Enable VT-x in your BIOS security settings, ensure that HAXM is in ...
- STL入门学习中碰到的一些函数
2020.02.10 fill #include<algorithm> vector<int> v{ 1, 2, 3, 3 }; fill(v.begin(), v.end() ...
- vsftp配置遇到的一些问题
设置匿名登陆的时候,要保证 /var/ftp/ 的所有者 是root,不然会一直提示输入用户名和密码,无法登陆! 上传的权限 local_umask =002 以及 匿名用户 anon_umask=0 ...
- 用友UAP NC 单据节点_打开参照字段的问题_从打不开参照放大镜_到成功打开了但是取不到值_到修复成功
项目的这个功能是17年开发的,但是当时没有测试通过,今年拿出来测试(通过后会上线). 有两个表数据一开始只打算用来计算时查询,没打算放到目标单据中做表体参照字段.后来改细节问题后放到目标单据中做参照字 ...
- python正式学习第二天
用python操作文件 步骤一:找到文件,打开文件 步骤二:修改文件 ,读取文件 步骤三:关闭文件,并保存 用代码演示如下: 1. f = open(file nama)2. f.read(#读取的字 ...
- Vue开发环境跨域访问
Vue开发环境跨域访问其他服务器或者本机其他端口,需要配置项目中config/index.js文件,修改如下 module.exports = { dev: { // Paths assetsSubD ...
- Android之碎片Fragment
Fragment是个特别的存在,有点像报纸上的专栏,看起来只占据页面的一小块,但是这一小块有自己的生命周期,可以自行其是,仿佛独立王国,并且这一小块的特性无论在哪个页面,给一个位置就行,添加以后不影响 ...
- 服务起不来,查看ps axj 看服务是否为守护进程(TPGID 为-1)
在linux命令行中输入: ps axj 查看服务进程的 TPGID 字段的值是否为-1 ,为-1表示为守护进程 不为-1表示不是守护进程,服务启动不起来,或者启动起来后又被杀死了
- VPS性能测试shell工具以及锐速安装
比较熟悉的UnixBench非常耗费资源,需要长时间跑满cpu和IO,很多主机商都深恶痛绝,会做各种限制,其实也代表不了实际使用的业务效果,毕竟真正需要那么多cpu和IO的应用并不多.而网络状况却是大 ...
- 查找pod使用的物理目录位置
例子:找出当前pod挂载的是哪个物理目录 # 先查看pod web-0 的yaml文件 # kubectl get pod web-0 -o yaml apiVersion: v1 kind: Pod ...