mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 16:30:03 +02:00
pas2js: json output: fixed error messages
git-svn-id: trunk@38040 -
This commit is contained in:
parent
ade2779f93
commit
e2d23ea70e
@ -978,8 +978,8 @@ begin
|
|||||||
try
|
try
|
||||||
if ShowDebug then
|
if ShowDebug then
|
||||||
begin
|
begin
|
||||||
Log.LogRaw('Pas-Module:');
|
Log.LogPlain('Pas-Module:');
|
||||||
Log.LogRaw(PasModule.GetDeclaration(true));
|
Log.LogPlain(PasModule.GetDeclaration(true));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// analyze
|
// analyze
|
||||||
@ -1007,7 +1007,7 @@ end;
|
|||||||
procedure TPas2jsCompilerFile.ParsePascal;
|
procedure TPas2jsCompilerFile.ParsePascal;
|
||||||
begin
|
begin
|
||||||
if ShowDebug then
|
if ShowDebug then
|
||||||
Log.LogRaw(['Debug: Parsing Pascal "',PasFilename,'"...']);
|
Log.LogPlain(['Debug: Parsing Pascal "',PasFilename,'"...']);
|
||||||
try
|
try
|
||||||
// parse Pascal
|
// parse Pascal
|
||||||
PascalResolver.InterfaceOnly:=IsForeign;
|
PascalResolver.InterfaceOnly:=IsForeign;
|
||||||
@ -1281,7 +1281,7 @@ begin
|
|||||||
// known unit
|
// known unit
|
||||||
if (aFile.PasUnitName<>'') and (CompareText(aFile.PasUnitName,UseUnitname)<>0) then
|
if (aFile.PasUnitName<>'') and (CompareText(aFile.PasUnitName,UseUnitname)<>0) then
|
||||||
begin
|
begin
|
||||||
Log.LogRaw(['Debug: TPas2jsPasTree.FindUnit unitname MISMATCH aFile.PasUnitname="',aFile.PasUnitName,'"',
|
Log.LogPlain(['Debug: TPas2jsPasTree.FindUnit unitname MISMATCH aFile.PasUnitname="',aFile.PasUnitName,'"',
|
||||||
' Self=',FileResolver.Cache.FormatPath(PasFilename),
|
' Self=',FileResolver.Cache.FormatPath(PasFilename),
|
||||||
' Uses=',UseUnitname,
|
' Uses=',UseUnitname,
|
||||||
' IsForeign=',IsForeign]);
|
' IsForeign=',IsForeign]);
|
||||||
@ -1302,7 +1302,7 @@ begin
|
|||||||
UseJSFilename:='';
|
UseJSFilename:='';
|
||||||
if (not IsForeign) then
|
if (not IsForeign) then
|
||||||
UseJSFilename:=FileResolver.FindUnitJSFileName(UsePasFilename);
|
UseJSFilename:=FileResolver.FindUnitJSFileName(UsePasFilename);
|
||||||
// Log.LogRaw(['Debug: TPas2jsPasTree.FindUnit Self=',FileResolver.Cache.FormatPath(PasFilename),
|
// Log.LogPlain(['Debug: TPas2jsPasTree.FindUnit Self=',FileResolver.Cache.FormatPath(PasFilename),
|
||||||
// ' Uses=',UseUnitname,' Found="',FileResolver.Cache.FormatPath(UsePasFilename),'"',
|
// ' Uses=',UseUnitname,' Found="',FileResolver.Cache.FormatPath(UsePasFilename),'"',
|
||||||
// ' IsForeign=',IsForeign,' JSFile="',FileResolver.Cache.FormatPath(useJSFilename),'"']);
|
// ' IsForeign=',IsForeign,' JSFile="',FileResolver.Cache.FormatPath(useJSFilename),'"']);
|
||||||
|
|
||||||
@ -1795,7 +1795,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
except
|
except
|
||||||
on E: Exception do begin
|
on E: Exception do begin
|
||||||
Log.LogRaw('Error: '+E.Message);
|
Log.LogPlain('Error: '+E.Message);
|
||||||
Log.LogMsg(nUnableToWriteFile,[FileCache.FormatPath(DestFilename)]);
|
Log.LogMsg(nUnableToWriteFile,[FileCache.FormatPath(DestFilename)]);
|
||||||
Terminate(ExitCodeWriteError);
|
Terminate(ExitCodeWriteError);
|
||||||
end;
|
end;
|
||||||
@ -1819,7 +1819,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
except
|
except
|
||||||
on E: Exception do begin
|
on E: Exception do begin
|
||||||
Log.LogRaw('Error: '+E.Message);
|
Log.LogPlain('Error: '+E.Message);
|
||||||
Log.LogMsg(nUnableToWriteFile,[FileCache.FormatPath(MapFilename)]);
|
Log.LogMsg(nUnableToWriteFile,[FileCache.FormatPath(MapFilename)]);
|
||||||
Terminate(ExitCodeWriteError);
|
Terminate(ExitCodeWriteError);
|
||||||
end;
|
end;
|
||||||
@ -1878,7 +1878,7 @@ end;
|
|||||||
|
|
||||||
procedure TPas2jsCompiler.RaiseInternalError(id: int64; Msg: string);
|
procedure TPas2jsCompiler.RaiseInternalError(id: int64; Msg: string);
|
||||||
begin
|
begin
|
||||||
Log.LogRaw('['+IntToStr(id)+'] '+Msg);
|
Log.LogPlain('['+IntToStr(id)+'] '+Msg);
|
||||||
raise Exception.Create(Msg);
|
raise Exception.Create(Msg);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2172,7 +2172,7 @@ end;
|
|||||||
|
|
||||||
procedure TPas2jsCompiler.ParamFatal(Msg: string);
|
procedure TPas2jsCompiler.ParamFatal(Msg: string);
|
||||||
begin
|
begin
|
||||||
Log.LogRaw(['Fatal: ',Msg]);
|
Log.LogPlain(['Fatal: ',Msg]);
|
||||||
Terminate(ExitCodeErrorInParams);
|
Terminate(ExitCodeErrorInParams);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2273,7 +2273,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
inc(p);
|
inc(p);
|
||||||
until false;
|
until false;
|
||||||
Log.LogRaw(Value);
|
Log.LogPlain(Value);
|
||||||
Terminate(0);
|
Terminate(0);
|
||||||
end;
|
end;
|
||||||
'B','l','n':
|
'B','l','n':
|
||||||
@ -3288,12 +3288,12 @@ begin
|
|||||||
if FHasShownLogo then exit;
|
if FHasShownLogo then exit;
|
||||||
FHasShownLogo:=true;
|
FHasShownLogo:=true;
|
||||||
WriteVersionLine;
|
WriteVersionLine;
|
||||||
Log.LogRaw('Copyright (c) 2017 Mattias Gaertner and others');
|
Log.LogPlain('Copyright (c) 2017 Mattias Gaertner and others');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPas2jsCompiler.WriteVersionLine;
|
procedure TPas2jsCompiler.WriteVersionLine;
|
||||||
begin
|
begin
|
||||||
Log.LogRaw('Pas2JS Compiler version '+GetVersion(false));
|
Log.LogPlain('Pas2JS Compiler version '+GetVersion(false));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPas2jsCompiler.WriteOptions;
|
procedure TPas2jsCompiler.WriteOptions;
|
||||||
@ -3367,37 +3367,37 @@ procedure TPas2jsCompiler.WriteInfo;
|
|||||||
begin
|
begin
|
||||||
WriteVersionLine;
|
WriteVersionLine;
|
||||||
Log.LogLn;
|
Log.LogLn;
|
||||||
Log.LogRaw('Compiler date : '+GetCompiledDate);
|
Log.LogPlain('Compiler date : '+GetCompiledDate);
|
||||||
Log.LogRaw('Compiler CPU target: '+GetCompiledTargetCPU);
|
Log.LogPlain('Compiler CPU target: '+GetCompiledTargetCPU);
|
||||||
Log.LogLn;
|
Log.LogLn;
|
||||||
Log.LogRaw('Supported targets (targets marked with ''{*}'' are under development):');
|
Log.LogPlain('Supported targets (targets marked with ''{*}'' are under development):');
|
||||||
Log.LogRaw([' ',PasToJsPlatformNames[PlatformBrowser],': webbrowser']);
|
Log.LogPlain([' ',PasToJsPlatformNames[PlatformBrowser],': webbrowser']);
|
||||||
Log.LogRaw([' ',PasToJsPlatformNames[PlatformNodeJS],': Node.js']);
|
Log.LogPlain([' ',PasToJsPlatformNames[PlatformNodeJS],': Node.js']);
|
||||||
Log.LogLn;
|
Log.LogLn;
|
||||||
Log.LogRaw('Supported CPU instruction sets:');
|
Log.LogPlain('Supported CPU instruction sets:');
|
||||||
Log.LogRaw(' ECMAScript5, ECMAScript6');
|
Log.LogPlain(' ECMAScript5, ECMAScript6');
|
||||||
Log.LogLn;
|
Log.LogLn;
|
||||||
Log.LogRaw('Recognized compiler and RTL features:');
|
Log.LogPlain('Recognized compiler and RTL features:');
|
||||||
Log.LogRaw(' RTTI,CLASSES,EXCEPTIONS,EXITCODE,RANDOM,DYNARRAYS,COMMANDARGS,');
|
Log.LogPlain(' RTTI,CLASSES,EXCEPTIONS,EXITCODE,RANDOM,DYNARRAYS,COMMANDARGS,');
|
||||||
Log.LogRaw(' UNICODESTRINGS');
|
Log.LogPlain(' UNICODESTRINGS');
|
||||||
Log.LogLn;
|
Log.LogLn;
|
||||||
Log.LogRaw('Supported Optimizations:');
|
Log.LogPlain('Supported Optimizations:');
|
||||||
Log.LogRaw(' EnumNumbers');
|
Log.LogPlain(' EnumNumbers');
|
||||||
Log.LogRaw(' RemoveNotUsedPrivates');
|
Log.LogPlain(' RemoveNotUsedPrivates');
|
||||||
Log.LogLn;
|
Log.LogLn;
|
||||||
Log.LogRaw('Supported Whole Program Optimizations:');
|
Log.LogPlain('Supported Whole Program Optimizations:');
|
||||||
Log.LogRaw(' RemoveNotUsedDeclarations');
|
Log.LogPlain(' RemoveNotUsedDeclarations');
|
||||||
Log.LogLn;
|
Log.LogLn;
|
||||||
Log.LogRaw('This program comes under the Library GNU General Public License');
|
Log.LogPlain('This program comes under the Library GNU General Public License');
|
||||||
Log.LogRaw('For more information read COPYING.FPC, included in this distribution');
|
Log.LogPlain('For more information read COPYING.FPC, included in this distribution');
|
||||||
Log.LogLn;
|
Log.LogLn;
|
||||||
Log.LogRaw('Please report bugs in our bug tracker on:');
|
Log.LogPlain('Please report bugs in our bug tracker on:');
|
||||||
Log.LogRaw(' http://bugs.freepascal.org');
|
Log.LogPlain(' http://bugs.freepascal.org');
|
||||||
Log.LogLn;
|
Log.LogLn;
|
||||||
Log.LogRaw('More information may be found on our WWW pages (including directions');
|
Log.LogPlain('More information may be found on our WWW pages (including directions');
|
||||||
Log.LogRaw('for mailing lists useful for asking questions or discussing potential');
|
Log.LogPlain('for mailing lists useful for asking questions or discussing potential');
|
||||||
Log.LogRaw('new features, etc.):');
|
Log.LogPlain('new features, etc.):');
|
||||||
Log.LogRaw(' http://www.freepascal.org');
|
Log.LogPlain(' http://www.freepascal.org');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TPas2jsCompiler.GetShownMsgTypes: TMessageTypes;
|
function TPas2jsCompiler.GetShownMsgTypes: TMessageTypes;
|
||||||
@ -3480,7 +3480,7 @@ begin
|
|||||||
aFile.CreateScannerAndParser(FileCache.CreateResolver);
|
aFile.CreateScannerAndParser(FileCache.CreateResolver);
|
||||||
|
|
||||||
if ShowDebug then
|
if ShowDebug then
|
||||||
Log.LogRaw(['Debug: Opening file "',PasFilename,'"...']);
|
Log.LogPlain(['Debug: Opening file "',PasFilename,'"...']);
|
||||||
// open file (beware: this changes aPasTree.FileResolver.BaseDirectory)
|
// open file (beware: this changes aPasTree.FileResolver.BaseDirectory)
|
||||||
aFile.OpenFile(PasFilename);
|
aFile.OpenFile(PasFilename);
|
||||||
end;
|
end;
|
||||||
|
@ -65,6 +65,7 @@ type
|
|||||||
procedure SetOutputFilename(AValue: string);
|
procedure SetOutputFilename(AValue: string);
|
||||||
procedure SetSorted(AValue: boolean);
|
procedure SetSorted(AValue: boolean);
|
||||||
procedure DoLogRaw(const Msg: string; SkipEncoding : Boolean);
|
procedure DoLogRaw(const Msg: string; SkipEncoding : Boolean);
|
||||||
|
function Concatenate(Args: array of const): string;
|
||||||
public
|
public
|
||||||
constructor Create;
|
constructor Create;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -74,14 +75,16 @@ type
|
|||||||
procedure LogRaw(const Msg: string); overload;
|
procedure LogRaw(const Msg: string); overload;
|
||||||
procedure LogRaw(Args: array of const); overload;
|
procedure LogRaw(Args: array of const); overload;
|
||||||
procedure LogLn;
|
procedure LogLn;
|
||||||
|
procedure LogPlain(const Msg: string); overload;
|
||||||
|
procedure LogPlain(Args: array of const); overload;
|
||||||
procedure LogMsg(MsgNumber: integer; Args: array of const;
|
procedure LogMsg(MsgNumber: integer; Args: array of const;
|
||||||
const Filename: string = ''; Line: integer = 0; Col: integer = 0;
|
const Filename: string = ''; Line: integer = 0; Col: integer = 0;
|
||||||
UseFilter: boolean = true);
|
UseFilter: boolean = true);
|
||||||
|
procedure Log(MsgType: TMessageType; Msg: string; MsgNumber: integer = 0;
|
||||||
|
const Filename: string = ''; Line: integer = 0; Col: integer = 0;
|
||||||
|
UseFilter: boolean = true);
|
||||||
procedure LogMsgIgnoreFilter(MsgNumber: integer; Args: array of const);
|
procedure LogMsgIgnoreFilter(MsgNumber: integer; Args: array of const);
|
||||||
function MsgTypeToStr(MsgType: TMessageType): string;
|
function MsgTypeToStr(MsgType: TMessageType): string;
|
||||||
procedure Log(MsgType: TMessageType; Msg: string; MsgNumber: integer = 0;
|
|
||||||
const Filename: string = ''; Line: integer = 0; Col: integer = 0;
|
|
||||||
UseFilter: boolean = true);
|
|
||||||
function GetMsgText(MsgNumber: integer; Args: array of const): string;
|
function GetMsgText(MsgNumber: integer; Args: array of const): string;
|
||||||
function FormatMsg(MsgType: TMessageType; Msg: string; MsgNumber: integer = 0;
|
function FormatMsg(MsgType: TMessageType; Msg: string; MsgNumber: integer = 0;
|
||||||
const Filename: string = ''; Line: integer = 0; Col: integer = 0): string;
|
const Filename: string = ''; Line: integer = 0; Col: integer = 0): string;
|
||||||
@ -423,7 +426,7 @@ var
|
|||||||
begin
|
begin
|
||||||
NewValue:=NormalizeEncoding(AValue);
|
NewValue:=NormalizeEncoding(AValue);
|
||||||
if FEncoding=NewValue then Exit;
|
if FEncoding=NewValue then Exit;
|
||||||
//LogRaw(ClassName+': Encoding changed from "'+FEncoding+'" to "'+NewValue+'"');
|
//LogPlain(ClassName+': Encoding changed from "'+FEncoding+'" to "'+NewValue+'"');
|
||||||
FEncoding:=NewValue;
|
FEncoding:=NewValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -488,7 +491,8 @@ begin
|
|||||||
S:=Msg
|
S:=Msg
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
if Encoding='utf8' then
|
if (Encoding='utf8') or (Encoding='json') then
|
||||||
|
S:=Msg
|
||||||
else if Encoding='console' then
|
else if Encoding='console' then
|
||||||
S:=UTF8ToConsole(Msg)
|
S:=UTF8ToConsole(Msg)
|
||||||
else if Encoding='system' then
|
else if Encoding='system' then
|
||||||
@ -500,7 +504,7 @@ begin
|
|||||||
S:=UTF8ToConsole(Msg);
|
S:=UTF8ToConsole(Msg);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
//writeln('TPas2jsLogger.LogRaw "',Encoding,'" "',DbgStr(S),'"');
|
//writeln('TPas2jsLogger.LogPlain "',Encoding,'" "',DbgStr(S),'"');
|
||||||
if FOnLog<>Nil then
|
if FOnLog<>Nil then
|
||||||
FOnLog(Self,S)
|
FOnLog(Self,S)
|
||||||
else if FOutputFile<>nil then
|
else if FOutputFile<>nil then
|
||||||
@ -513,6 +517,41 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TPas2jsLogger.Concatenate(Args: array of const): string;
|
||||||
|
var
|
||||||
|
s: String;
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
s:='';
|
||||||
|
for i:=Low(Args) to High(Args) do
|
||||||
|
begin
|
||||||
|
case Args[i].VType of
|
||||||
|
vtInteger: s += IntToStr(Args[i].VInteger);
|
||||||
|
vtBoolean: s += BoolToStr(Args[i].VBoolean);
|
||||||
|
vtChar: s += Args[i].VChar;
|
||||||
|
{$ifndef FPUNONE}
|
||||||
|
vtExtended: ; // Args[i].VExtended^;
|
||||||
|
{$ENDIF}
|
||||||
|
vtString: s += Args[i].VString^;
|
||||||
|
vtPointer: ; // Args[i].VPointer;
|
||||||
|
vtPChar: s += Args[i].VPChar;
|
||||||
|
vtObject: ; // Args[i].VObject;
|
||||||
|
vtClass: ; // Args[i].VClass;
|
||||||
|
vtWideChar: s += AnsiString(Args[i].VWideChar);
|
||||||
|
vtPWideChar: s += AnsiString(Args[i].VPWideChar);
|
||||||
|
vtAnsiString: s += AnsiString(Args[i].VAnsiString);
|
||||||
|
vtCurrency: ; // Args[i].VCurrency^);
|
||||||
|
vtVariant: ; // Args[i].VVariant^);
|
||||||
|
vtInterface: ; // Args[i].VInterface^);
|
||||||
|
vtWidestring: s += AnsiString(WideString(Args[i].VWideString));
|
||||||
|
vtInt64: s += IntToStr(Args[i].VInt64^);
|
||||||
|
vtQWord: s += IntToStr(Args[i].VQWord^);
|
||||||
|
vtUnicodeString:s += AnsiString(UnicodeString(Args[i].VUnicodeString));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
Result:=s;
|
||||||
|
end;
|
||||||
|
|
||||||
constructor TPas2jsLogger.Create;
|
constructor TPas2jsLogger.Create;
|
||||||
begin
|
begin
|
||||||
FMsg:=TFPList.Create;
|
FMsg:=TFPList.Create;
|
||||||
@ -612,38 +651,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPas2jsLogger.LogRaw(Args: array of const);
|
procedure TPas2jsLogger.LogRaw(Args: array of const);
|
||||||
var
|
|
||||||
s: String;
|
|
||||||
i: Integer;
|
|
||||||
begin
|
begin
|
||||||
s:='';
|
LogRaw(Concatenate(Args));
|
||||||
for i:=Low(Args) to High(Args) do
|
|
||||||
begin
|
|
||||||
case Args[i].VType of
|
|
||||||
vtInteger: s += IntToStr(Args[i].VInteger);
|
|
||||||
vtBoolean: s += BoolToStr(Args[i].VBoolean);
|
|
||||||
vtChar: s += Args[i].VChar;
|
|
||||||
{$ifndef FPUNONE}
|
|
||||||
vtExtended: ; // Args[i].VExtended^;
|
|
||||||
{$ENDIF}
|
|
||||||
vtString: s += Args[i].VString^;
|
|
||||||
vtPointer: ; // Args[i].VPointer;
|
|
||||||
vtPChar: s += Args[i].VPChar;
|
|
||||||
vtObject: ; // Args[i].VObject;
|
|
||||||
vtClass: ; // Args[i].VClass;
|
|
||||||
vtWideChar: s += AnsiString(Args[i].VWideChar);
|
|
||||||
vtPWideChar: s += AnsiString(Args[i].VPWideChar);
|
|
||||||
vtAnsiString: s += AnsiString(Args[i].VAnsiString);
|
|
||||||
vtCurrency: ; // Args[i].VCurrency^);
|
|
||||||
vtVariant: ; // Args[i].VVariant^);
|
|
||||||
vtInterface: ; // Args[i].VInterface^);
|
|
||||||
vtWidestring: s += AnsiString(WideString(Args[i].VWideString));
|
|
||||||
vtInt64: s += IntToStr(Args[i].VInt64^);
|
|
||||||
vtQWord: s += IntToStr(Args[i].VQWord^);
|
|
||||||
vtUnicodeString:s += AnsiString(UnicodeString(Args[i].VUnicodeString));
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
LogRaw(s);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPas2jsLogger.LogLn;
|
procedure TPas2jsLogger.LogLn;
|
||||||
@ -651,25 +660,46 @@ begin
|
|||||||
LogRaw('');
|
LogRaw('');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TPas2jsLogger.LogPlain(const Msg: string);
|
||||||
|
var
|
||||||
|
s: String;
|
||||||
|
begin
|
||||||
|
if encoding='json' then
|
||||||
|
begin
|
||||||
|
s:=FormatJSONMsg(mtInfo,Msg,0,'',0,0);
|
||||||
|
DoLogRaw(s,True);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
DoLogRaw(Msg,False);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TPas2jsLogger.LogPlain(Args: array of const);
|
||||||
|
begin
|
||||||
|
LogPlain(Concatenate(Args));
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TPas2jsLogger.LogMsg(MsgNumber: integer; Args: array of const;
|
procedure TPas2jsLogger.LogMsg(MsgNumber: integer; Args: array of const;
|
||||||
const Filename: string; Line: integer; Col: integer; UseFilter: boolean);
|
const Filename: string; Line: integer; Col: integer; UseFilter: boolean);
|
||||||
var
|
var
|
||||||
s: String;
|
|
||||||
Msg: TPas2jsMessage;
|
Msg: TPas2jsMessage;
|
||||||
begin
|
begin
|
||||||
Msg:=FindMsg(MsgNumber,true);
|
Msg:=FindMsg(MsgNumber,true);
|
||||||
if UseFilter and not (Msg.Typ in FShowMsgTypes) then exit;
|
Log(Msg.Typ,SafeFormat(Msg.Pattern,Args),MsgNumber,Filename,Line,Col,UseFilter);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TPas2jsLogger.Log(MsgType: TMessageType; Msg: string;
|
||||||
|
MsgNumber: integer; const Filename: string; Line: integer; Col: integer;
|
||||||
|
UseFilter: boolean);
|
||||||
|
var
|
||||||
|
s: String;
|
||||||
|
begin
|
||||||
|
if UseFilter and not (MsgType in FShowMsgTypes) then exit;
|
||||||
if MsgNumberDisabled[MsgNumber] then exit;
|
if MsgNumberDisabled[MsgNumber] then exit;
|
||||||
if encoding='json' then
|
if encoding='json' then
|
||||||
begin
|
s:=FormatJSONMsg(MsgType,Msg,MsgNumber,Filename,Line,Col)
|
||||||
s:=FormatJSONMsg(Msg.Typ,SafeFormat(Msg.Pattern,Args),MsgNumber,Filename,Line,Col);
|
|
||||||
DoLogRaw(S,True);
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
begin
|
s:=FormatMsg(MsgType,Msg,MsgNumber,Filename,Line,Col);
|
||||||
s:=FormatMsg(Msg.Typ,SafeFormat(Msg.Pattern,Args),MsgNumber,Filename,Line,Col);
|
LogRaw(s);
|
||||||
DoLogRaw(S,False);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPas2jsLogger.LogMsgIgnoreFilter(MsgNumber: integer;
|
procedure TPas2jsLogger.LogMsgIgnoreFilter(MsgNumber: integer;
|
||||||
@ -692,18 +722,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPas2jsLogger.Log(MsgType: TMessageType; Msg: string;
|
|
||||||
MsgNumber: integer; const Filename: string; Line: integer; Col: integer;
|
|
||||||
UseFilter: boolean);
|
|
||||||
var
|
|
||||||
s: String;
|
|
||||||
begin
|
|
||||||
if UseFilter and not (MsgType in FShowMsgTypes) then exit;
|
|
||||||
if MsgNumberDisabled[MsgNumber] then exit;
|
|
||||||
s:=FormatMsg(MsgType,Msg,MsgNumber,Filename,Line,Col);
|
|
||||||
LogRaw(s);
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TPas2jsLogger.FormatMsg(MsgType: TMessageType; Msg: string;
|
function TPas2jsLogger.FormatMsg(MsgType: TMessageType; Msg: string;
|
||||||
MsgNumber: integer; const Filename: string; Line: integer; Col: integer
|
MsgNumber: integer; const Filename: string; Line: integer; Col: integer
|
||||||
): string;
|
): string;
|
||||||
|
Loading…
Reference in New Issue
Block a user