用户工具

站点工具


侧边栏

script:unityengine:classes:logger:logger

Logger 记录器

class in UnityEngine Implements interfaces: ILogger, ILogHandler

Description 描述

Initializes a new instance of the Logger.

初始化新的实例化的记录器。

Create a new instance or use default Debug.logger. See Also: ILogger, ILogHandler.

创建新的实例或者使用默认Debug.logger。请参考ILogger, ILogHandler。

JavaScript:

#pragma strict
public class MyLogHandler implements ILogHandler {
	public function LogFormat(logType: LogType, context: UnityEngine.Object, format: String, args: Object[]) {
		Debug.logger.logHandler.LogFormat(logType, context, format, args);
	}
	public function LogException(exception: Exception, context: UnityEngine.Object) {
		Debug.logger.LogException(exception, context);
	}
}
public class MyGameClass extends MonoBehaviour {
	private static var kTAG: String = "MyGameTag";
	private var myLogger: Logger;
	function Start() {
		myLogger = new Logger(new MyLogHandler());
		myLogger.Log(kTAG, "MyGameClass Start.");
	}
}

C#:

using UnityEngine;
using System.Collections;
using System.IO;
using System;
 
public class MyLogHandler : ILogHandler
{
    public void LogFormat (LogType logType, UnityEngine.Object context, script/unityengine/classes/logger/logger.txt · 最后更改: 2016/08/02 05:32 (外部编辑)