-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathocklogging.pas
55 lines (45 loc) · 1.25 KB
/
ocklogging.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
unit ocklogging;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, oslog, jwawinbase, proginfo;
function initLogging(const clientname: string): boolean;
var
logfilename:string;
implementation
{:Returns user name of the current thread.
@author Miha-R, Lee_Nover
@since 2002-11-25
}
function GetUserName_: string;
var
buffer: PChar;
bufferSize: DWORD;
begin
bufferSize := 256; //UNLEN from lmcons.h
buffer := AllocMem(bufferSize * SizeOf(char));
try
GetUserName(buffer, bufferSize);
Result := string(buffer);
finally
FreeMem(buffer, bufferSize);
end;
end; { DSiGetUserName}
function initLogging(const clientname: string): boolean;
var
i : integer;
begin
Result := True;
LogDatei := TLogInfo.Create;
logfilename := 'kiosk-' + GetUserName_ +'.log';
LogDatei.WritePartLog := False;
LogDatei.WriteErrFile:= False;
LogDatei.WriteHistFile:= False;
logdatei.CreateTheLogfile(logfilename, False);
logdatei.LogLevel := 7; //myloglevel;
//for i := 0 to preLogfileLogList.Count-1 do
// logdatei.log(preLogfileLogList.Strings[i], LLessential);
//preLogfileLogList.Free;
logdatei.log('opsi-client-kiosk: version: ' + ProgramInfo.Version, LLessential);
end;
end.