-
Notifications
You must be signed in to change notification settings - Fork 0
/
LogGen.py
executable file
·90 lines (77 loc) · 3.5 KB
/
LogGen.py
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
#/////////////////////////////////////////////////////////////////
# Author : youngunix (zagazaw2004 [at] google mail [dot] com)
# Name : LogGen
# Version: 1.3
# License: GPLv3
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
# Copy (C) 2015 youngunix
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.
#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. See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with this program. If not, see <http://www.gnu.org/licenses/>.
#!/usr/bin/env python
import getpass
import platform
from datetime import datetime, date, time
DATE = datetime.now()
USER = getpass.getuser()
MACH = platform.machine()
HOST = platform.node()
SYS = platform.system()
RELENG = platform.release()
#--------------------------
VERSION = "v.1.3"
# Licensing & Info
print('''
\//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
LogGen v. 1.3
///////////////// Copy (C) 2015 youngunix /////////////////
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to modify and or
redistribute it under certain conditions (see 'License' file).
For documentation and how-to, see 'ABOUT' file.
/////////////////////////////////////////////////////////////
Hit the [ENTER] key after you are done typing for each section.
\//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
''')
# Collect user's input
while True:
Title_INPUT = raw_input("Enter Title: ")
if Title_INPUT == "":
print('/!\ You musr enter a title for the log! /!\\')
elif Title_INPUT != "":
break
DateByUser_INPUT = raw_input("Enter Date (USER): ")
Desc_INPUT = raw_input("Enter Description: ")
Goal_INPUT = raw_input("Enter Goal: ")
Status_INPUT = raw_input("Enter Status: ")
Steps_INPUT = raw_input("Enter Steps: ")
Comments_INPUT = raw_input("Enter Comments: ")
# Create the log file (will be in current directory)
# /!\ WARNNING /!\ logs will be overwritten if you don't use a different title
INPUT_FILE = open(Title_INPUT + '.log', 'w')
# Write user's input to the log file
INPUT_FILE.write('************************************************************************' + '\n')
INPUT_FILE.write('---- This log was generated by [' + USER + '] using LogGen '+ VERSION +' script ----' + '\n')
INPUT_FILE.write('************************************************************************' + '\n\n')
INPUT_FILE.write('Title: ' + Title_INPUT + '\n')
INPUT_FILE.write('Date (SYSTEM): ' + str(DATE) + '\n')
INPUT_FILE.write('Date (USER): ' + DateByUser_INPUT + '\n')
INPUT_FILE.write('Username: ' + USER + '\n')
INPUT_FILE.write('Hostname: ' + HOST + '\n')
INPUT_FILE.write('Arch: ' + MACH + '\n')
INPUT_FILE.write('System: ' + SYS + '\n')
INPUT_FILE.write('Realese: ' + RELENG + '\n')
INPUT_FILE.write('Description: ' + Desc_INPUT + '\n')
INPUT_FILE.write('Goal: ' + Goal_INPUT + '\n')
INPUT_FILE.write('Status: ' + Status_INPUT + '\n')
INPUT_FILE.write('Steps: ' + Steps_INPUT + '\n')
INPUT_FILE.write('Comments: ' + Comments_INPUT + '\n')
# Close the log file
INPUT_FILE.close()