LogConfigurationAddTarget Method

新增自訂 Target

Definition

Namespace: eBizprise.Framework
Assembly: eBizprise.Framework.Log.LogHelper (in eBizprise.Framework.Log.LogHelper.dll) Version: 26.0.1.0+8b857ad8115790502a00f482082d0feffe7e9c92
C#
public LogConfiguration AddTarget(
	string targetName,
	Target target,
	LogLevel minLevel = null,
	LogLevel maxLevel = null
)

Parameters

targetName  String
Target 名稱
target  Target
Target 物件
minLevel  LogLevel  (Optional)
最低等級
maxLevel  LogLevel  (Optional)
最高等級

Return Value

LogConfiguration
配置物件(支援鏈式呼叫)

Example

C#
var customTarget = new FileTarget("custom")
{
    FileName = "${var:main}/custom.log"
};
config.AddTarget("custom", customTarget, LogLevel.Info);

See Also