forked from necokeine/StreamOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
debug.pp
68 lines (53 loc) · 1.62 KB
/
debug.pp
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
56
57
58
59
60
61
62
63
64
65
66
67
// vim: ts=3:filetype=pascal
(* Copyright (C) 2004-2009 Oleksandr Natalenko aka post-factum
This program is free software; you can redistribute it and/or modify
it under the terms of the Universal Program License as published by
Oleksandr Natalenko aka post-factum; see file COPYING for details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
You should have received a copy of the Universal Program
License along with this program; if not, write to
unit
debug;
interface
uses
stypes;
procedure DebugReportEvent(message: String);
procedure DebugMark(message: String);
var
debugToFile: Boolean;
debugLock: TLockContainer;
implementation
uses
sysutils,
modules,
fs,
kernel,
lock;
(*===reports debug event to debug stream (virtual system console or file)===*)
procedure DebugReportEvent(message: String);
var
logf: TextFile;
begin
EnterLock(debugLock);
(*it displays debug messages from kernel (pid=0) with timestamps*)
if debugToFile then
begin
Assign(logf, fs.StreamFSToDOS('/var/log/kern.log'));
Append(logf);
WriteLn(logf, FormatDateTime('mmm d hh:nn:ss', now) + ' ' + kernel.kernelHostname + ': ' + message);
Close(logf);
end
else
DisplayTextOutLn(FormatDateTime('mmm d hh:nn:ss', now) + ' ' + kernel.kernelHostname + ': ' + message, 0);
LeaveLock(debugLock);
end;
(*===shows kernel mark directly to the physical console===*)
procedure DebugMark(message: String);
begin
WriteLn('Kernel mark: ' + message);
end;
begin
end.