Skip to content

Commit f5a02e1

Browse files
committed
comments and copyright in test script
1 parent fd2d781 commit f5a02e1

File tree

1 file changed

+43
-2
lines changed

1 file changed

+43
-2
lines changed

fsx_analyze.py

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,44 @@
11
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33

4+
"""
5+
6+
LoggedFS-python
7+
Filesystem monitoring with Fuse and Python
8+
https://github.com/pleiszenburg/loggedfs-python
9+
10+
fsx_analyze.py: Merge the output of fsx-linux and LoggedFS and display result
11+
12+
Copyright (C) 2017-2018 Sebastian M. Ernst <[email protected]>
13+
14+
<LICENSE_BLOCK>
15+
The contents of this file are subject to the Apache License
16+
Version 2 ("License"). You may not use this file except in
17+
compliance with the License. You may obtain a copy of the License at
18+
https://www.apache.org/licenses/LICENSE-2.0
19+
https://github.com/pleiszenburg/loggedfs-python/blob/master/LICENSE
20+
21+
Software distributed under the License is distributed on an "AS IS" basis,
22+
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the
23+
specific language governing rights and limitations under the License.
24+
</LICENSE_BLOCK>
25+
26+
"""
27+
28+
29+
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
30+
# IMPORT
31+
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
432

533
import datetime
634
import os
735
import sys
836

937

38+
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
39+
# CONST
40+
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
41+
1042
# https://en.wikipedia.org/wiki/ANSI_escape_code
1143
c = {
1244
'RESET': '\033[0;0m',
@@ -23,6 +55,10 @@
2355
}
2456

2557

58+
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
59+
# ROUTINES
60+
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
61+
2662
def print_line(line_dict):
2763
t = str(line_dict['t'])
2864
sys.stdout.write(c['GREY'] + t[:-9] + '.' + t[-9:] + c['RESET'] + ' ')
@@ -76,10 +112,10 @@ def split_at(in_str, separator, position):
76112
def parse_fs_line(line):
77113

78114
ts, payload = split_at(line, ' ', 2)
79-
if payload.startswith('INFO [default] '): # original loggedfs
115+
if payload.startswith('INFO [default] '): # original LoggedFS
80116
_, payload = split_at(payload, ' ', 2)
81117
_original_loggedfs = True
82-
else:
118+
else: # LoggedFS-python
83119
_, payload = split_at(payload, ' ', 1)
84120
_original_loggedfs = False
85121
command, payload = payload.split(' ', 1)
@@ -148,5 +184,10 @@ def main():
148184
print_line(line)
149185

150186

187+
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
188+
# ENTRY POINT
189+
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
190+
151191
if __name__ == '__main__':
192+
152193
main()

0 commit comments

Comments
 (0)