需要使用的插件库说明:

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

  1. unity工程接入Android sdk后真机测试解锁屏后退出的解决

    unity工程接入如91.移动支付等Android sdk后,真机运行尤其是在4.0+以上坏境,往往会出现解锁屏后退出的情况,解决办法如下: 可以在AndroidManifest.xml中所有的con ...

  2. 用Visual Studio创建集成了gtest的命令行工程

    gtest代码库中的sample代码 在gtest的代码库中,包含了10个sample的代码,覆盖了gtest的常见用法,sample的代码位于以下文件夹: gtest\samples 由于gtest ...

  3. asp.net core 集成 log4net 日志框架

    asp.net core 集成 log4net 日志框架 Intro 在 asp.net core 中有些日志我们可能想输出到数据库或文件或elasticsearch等,如果不自己去实现一个 Logg ...

  4. 【Unity_UWP】Unity 工程发布win10 UWP 时的本地文件读取 (下篇)

    Universal Windows Platform(UWP)是微软Windows10专用的通用应用平台,其目的在于在统一操作系统下控制所有智能电子设备. 自从Unity 5.2之后,配合VS 201 ...

  5. 【Unity_UWP】Unity 工程发布win10 UWP 时的本地文件读取 (上篇)

    Universal Windows Platform(UWP)是微软Windows10专用的通用应用平台,其目的在于在统一操作系统下控制所有智能电子设备. 自从Unity 5.2之后,配合VS 201 ...

  6. 升级MAC OS到10.13, 10.14系统后UNITY工程无法加载资源的解决办法

    升级MAC OS到10.13, 10.14系统后,出现UNITY工程无法加载资源的情况: Unity项目中Asset目录显示为空! 解决办法一: 打开Launchpad中的磁盘工具 (也就是实用工具下 ...

  7. Unity工程资源破解

        Unity工程资源提取其实还是很方便的,网上也有很多相关介绍,比如雨凇就专门写了一遍关于破解Unity资源的文章(http://www.xuanyusong.com/archives/3618 ...

  8. Asp.Net Core 进阶(二) —— 集成Log4net

    Asp.Net Core 支持适用于各种内置日志记录API,同时也支持其他第三方日志记录.在我们新建项目后,在Program 文件入口调用了CreateDefaultBuilder,该操作默认将添加以 ...

  9. Unity工程无代码化

     目的 Unity默认是将代码放入工程,这样容易带来一些问题.1. 代码和资源混合,职能之间容易互相误改.2. 当代码量膨胀到一定程度后,代码的编译时间长到无法忍受.新版的unity支持通过asmde ...

随机推荐

  1. P1525 关押罪犯【二分+二分图】

    输入输出样例 输入 #1 复制 4 6 1 4 2534 2 3 3512 1 2 28351 1 3 6618 2 4 1805 3 4 12884 思路 对于要求最大值最小的问题,不难想到二分. ...

  2. Magento2 updated quote_item table - 更新quote_item 表自定义字段

    /** * @param $class * @return mixed */ public function mc_get_obj($class) { return \Magento\Framewor ...

  3. Tomcat + mysql + myeclipse 启动遇到的问题

    1. 问题: Tomcat启动时报错如下:Table 'performance_schema.session_variables' doesn't exist 2. 网络上普遍找到的解决办法: 控制台 ...

  4. 学习postgresql spi(一)

    #include "postgres.h" #include #include "fmgr.h" #include "access/xlog.h&qu ...

  5. pyqt5-下拉框联动效果

    from PyQt5.Qt import * class MyWindow(QWidget): def __init__(self): super().__init__() self.setWindo ...

  6. drf 接口文档

    coreapi 参考点击 swagger风格接口文档 参考 参考用例 swagger 使用参考

  7. spark.streaming.kafka.maxRatePerPartition的理解

    spark.streaming.kafka.maxRatePerPartition设定对目标topic每个partition每秒钟拉取的数据条数. 假设此项设为1,批次间隔为10s,目标topic只有 ...

  8. 题解【洛谷P3456】[POI2007]GRZ-Ridges and Valleys

    题面 考虑 \(\text{Flood Fill}\). 每次在 \(\text{BFS}\) 扩展的过程中增加几个判断条件,记录山峰和山谷的个数即可. #include <bits/stdc+ ...

  9. C# 引入Sqlite 未能加载文件或程序集“System.Data.SQLite

    个人博客 地址:https://www.wenhaofan.com/article/20190501224046 问题 在Visual Studio 中 使用NuGet 通过 install-pack ...

  10. http断点续传Range与Content-Range

    今天用别人封装的libcurl库下载文件,发现下载下来的文件总是缺少头两个字节,用以下配置启用HTTP头信息打印后发现原来是设置了断点续传位置的原因 curl_easy_setopt(m_pCurl, ...