-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathlogboek.py
More file actions
211 lines (122 loc) · 3.72 KB
/
logboek.py
File metadata and controls
211 lines (122 loc) · 3.72 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
from ctypes import *
import os
lib = cdll.LoadLibrary(os.environ.get("LOGBOEK_SO_PATH", os.path.join(os.path.dirname(os.path.abspath(__file__)), "_logboek.so")))
class Error(Exception): pass
lib.Init.argtypes = []
lib.Init.restype = c_char_p
def Init():
res = lib.Init()
if res != None:
raise Error(res)
lib.DisablePrettyLog.argtypes = []
lib.DisablePrettyLog.restype = None
def DisablePrettyLog():
lib.DisablePrettyLog()
lib.EnableLogColor.argtypes = []
lib.EnableLogColor.restype = None
def EnableLogColor():
lib.EnableLogColor()
lib.DisableLogColor.argtypes = []
lib.DisableLogColor.restype = None
def DisableLogColor():
lib.DisableLogColor()
lib.SetTerminalWidth.argtypes = [c_int]
lib.SetTerminalWidth.restype = None
def SetTerminalWidth(width):
lib.SetTerminalWidth(width)
lib.IndentUp.argtypes = []
lib.IndentUp.restype = None
def IndentUp():
lib.IndentUp()
lib.IndentDown.argtypes = []
lib.IndentDown.restype = None
def IndentDown():
lib.IndentDown()
lib.OptionalLnModeOn.argtypes = []
lib.OptionalLnModeOn.restype = None
def OptionalLnModeOn():
lib.OptionalLnModeOn()
lib.Log.argtypes = [c_char_p]
lib.Log.restype = None
def Log(data):
lib.Log(data)
lib.LogHighlight.argtypes = [c_char_p]
lib.LogHighlight.restype = None
def LogHighlight(data):
lib.LogHighlight(data)
lib.LogService.argtypes = [c_char_p]
lib.LogService.restype = None
def LogService(data):
lib.LogService(data)
lib.LogInfo.argtypes = [c_char_p]
lib.LogInfo.restype = None
def LogInfo(data):
lib.LogInfo(data)
lib.LogError.argtypes = [c_char_p]
lib.LogError.restype = None
def LogError(data):
lib.LogError(data)
lib.LogProcessStart.argtypes = [c_char_p]
lib.LogProcessStart.restype = None
def LogProcessStart(msg):
lib.LogProcessStart(msg)
lib.LogProcessEnd.argtypes = [c_bool]
lib.LogProcessEnd.restype = None
def LogProcessEnd(**kwargs):
lib.LogProcessEnd(kwargs.get("without_log_optional_ln", False))
lib.LogProcessFail.argtypes = [c_bool]
lib.LogProcessFail.restype = None
def LogProcessFail(**kwargs):
lib.LogProcessFail(kwargs.get("without_log_optional_ln", False))
lib.LogProcessStepEnd.argtypes = [c_char_p]
lib.LogProcessStepEnd.restype = None
def LogProcessStepEnd(msg):
lib.LogProcessStepEnd(msg)
lib.FitText.argtypes = [c_char_p, c_int, c_int, c_bool]
lib.FitText.restype = c_char_p
def FitText(text, **kwargs):
return lib.FitText(text, kwargs.get("extra_indent_width", 0), kwargs.get("max_width", 0),kwargs.get("mark_wrapped_file", False))
lib.GetRawStreamsOutputMode.argtypes = []
lib.GetRawStreamsOutputMode.restype = c_bool
def GetRawStreamsOutputMode():
return lib.GetRawStreamsOutputMode()
lib.RawStreamsOutputModeOn.argtypes = []
lib.RawStreamsOutputModeOn.restype = None
def RawStreamsOutputModeOn():
lib.RawStreamsOutputModeOn()
lib.RawStreamsOutputModeOff.argtypes = []
lib.RawStreamsOutputModeOff.restype = None
def RawStreamsOutputModeOff():
lib.RawStreamsOutputModeOff()
lib.EnableFitMode.argtypes = []
lib.EnableFitMode.restype = None
def EnableFitMode():
lib.EnableFitMode()
lib.EnableFitMode.argtypes = []
lib.EnableFitMode.restype = None
def DisableFitMode():
lib.DisableFitMode()
lib.MuteOut.argtypes = []
lib.MuteOut.restype = None
def MuteOut():
lib.MuteOut()
lib.UnmuteOut.argtypes = []
lib.UnmuteOut.restype = None
def UnmuteOut():
lib.UnmuteOut()
lib.MuteErr.argtypes = []
lib.MuteErr.restype = None
def MuteErr():
lib.MuteErr()
lib.UnmuteErr.argtypes = []
lib.UnmuteErr.restype = None
def UnmuteErr():
lib.UnmuteErr()
lib.Out.argtypes = [c_char_p]
lib.Out.restype = None
def Out(data):
lib.Out(data)
lib.Err.argtypes = [c_char_p]
lib.Err.restype = None
def Err(data):
lib.Out(data)