-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLogOnAOSFile.cs
More file actions
55 lines (44 loc) · 1.47 KB
/
LogOnAOSFile.cs
File metadata and controls
55 lines (44 loc) · 1.47 KB
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
class LogOnAOSFile implements IWritable
{
}
private void new()
{
}
public void write(Notes text, str context="", boolean status=0, Notes title= funcName())
{
Session s = new Session();
Filename fileName, hostFolderName;
TextIo textIo;
str userName;
Set permissionSet;
#File
;
// Set the file path on server
fileName = @"C:\\DAXDev_Log.txt";
userName=curUserId();
// Set the permission contract for writing to file
permissionSet = new Set(Types::Class);
permissionSet.add(new FileIOPermission(fileName, #IO_APPEND));
//Assert the permissions
CodeAccessPermission::assertMultiple(permissionSet);
// Write the content
textIo = new TextIo(fileName, #IO_APPEND);
textIo.write(strFmt("%1, %2, %3, %4 | %5", title, text, context, status, userName));
// Take back the permissions
CodeAccessPermission::revertAssert();
}
public static LogOnAOSFile instance()
{
LogOnAOSFile singleton;
SysGlobalCache globalCache = infolog.objectOnServer() ? appl.globalCache() : infolog.globalCache();
;
if (globalCache.isSet(classStr(LogOnAOSFile), 0))
singleton = globalCache.get(classStr(LogOnAOSFile), 0);
else
{
singleton = new LogOnAOSFile();
infoLog.globalCache().set(classStr(LogOnAOSFile), 0, singleton);
appl.globalCache().set(classStr(LogOnAOSFile), 0, singleton);
}
return singleton;
}