-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathutil_foo.py
87 lines (59 loc) · 2.44 KB
/
util_foo.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
# -*- coding: utf-8 -*-
# collection of utility functions, not for classes
import sys
import os
#import stat
import time
#import shutil
#import os,os.path
# import Queue
#import logging
import datetime
# --------------------------------------------
def prog_info( controller ):
#logger_level( "util_foo.prog_info" )
logger = controller.logger
logger.info( "" )
logger.info( "============================" )
logger.info( "" )
title = "Application: " + controller.app_name + " " + controller.app_version
logger.info( title )
logger.info( "" )
if len( sys.argv ) == 0:
logger.info( "no command line arg " )
else:
ix_arg = 0
for aArg in sys.argv: # enumerate probably the right way
logger.info( "command line arg " + str( ix_arg ) + " = " + sys.argv[ix_arg])
ix_arg += 1
logger.info( "current directory " + os.getcwd() )
start_ts = time.time()
dt_obj = datetime.datetime.utcfromtimestamp( start_ts )
string_rep = dt_obj.strftime('%Y-%m-%d %H:%M:%S')
logger.info( "Time now: " + string_rep )
# logger_level( "Parameters say log to: " + self.parameters.pylogging_fn ) parameters and controller not available can ge fro logger_level
return
# --------------------------------------------
def prog_info_old( logger_level, title ):
#logger_level( "util_foo.prog_info" )
logger_level( "" )
logger_level( "============================" )
logger_level( "" )
logger_level( title )
logger_level( "" )
if len( sys.argv ) == 0:
logger_level( "no command line arg " )
else:
ix_arg = 0
for aArg in sys.argv: # enumerate probably the right way
logger_level( "command line arg " + str( ix_arg ) + " = " + sys.argv[ix_arg])
ix_arg += 1
logger_level( "current directory " + os.getcwd() )
start_ts = time.time()
dt_obj = datetime.datetime.utcfromtimestamp( start_ts )
string_rep = dt_obj.strftime('%Y-%m-%d %H:%M:%S')
logger_level( "Time now: " + string_rep )
# logger_level( "Parameters say log to: " + self.parameters.pylogging_fn ) parameters and controller not available can ge fro logger_level
return
# ========================== eof =================================
# ========================== eof =================================