【发布时间】:2021-02-22 00:55:50
【问题描述】:
我正在尝试过滤我的日志记录。如果选项中有日志(或消息)类型,我想将其发送到日志,否则退出。
在“if not MessageType in...”行编译失败:
"[dcc32 Error] uMain.pas(2424): E2015 Operator not applicable to this operand type"
我认为基于 Include/Exclude 函数必须是可能的(并且相当简单),我尝试查看但在任何地方都找不到(即 Include(MySet, llInfo); )。
我的声明如下:
type
TLogLevel = (llDebug, llError, llWarn, llInfo, llException);
TLogOptions = set of TLogLevel;
var
FLogOptions: TLogOptions;
procedure TfrmMain.Log(const s: String; MessageType: TLogLevel;
DebugLevel: Integer; Filter: Boolean = True);
begin
if not MessageType in FLogOptions then
exit;
mmoLog.Lines.Add(s);
end;
【问题讨论】:
-
抱歉!!我应该补充一点,在“if not MessageType in...”行编译失败:[dcc32 Error] uMain.pas(2424): E2015 Operator not applicable to this operand type
-
复制那个。谢谢!
标签: delphi set enumeration