LogConfigurationAddTarget Method

新增自訂 Target

Definition

Namespace: eBizprise.Framework
Assembly: eBizprise.Framework.Log.LogHelper (in eBizprise.Framework.Log.LogHelper.dll) Version: 25.0.4.0+adf38c4ccb2bf98d8ad258a6278302b5e05a94ed
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