Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Douglas
erp5
Commits
85f94aa9
Commit
85f94aa9
authored
Aug 03, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initialise logging support.
parent
a5d06e80
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
erp5/util/testnode/__init__.py
erp5/util/testnode/__init__.py
+16
-0
No files found.
erp5/util/testnode/__init__.py
View file @
85f94aa9
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
##############################################################################
##############################################################################
import
ConfigParser
import
ConfigParser
import
argparse
import
argparse
import
logging
import
os
import
os
import
pkg_resources
import
pkg_resources
...
@@ -40,10 +41,25 @@ def main(*args):
...
@@ -40,10 +41,25 @@ def main(*args):
parser
=
argparse
.
ArgumentParser
()
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"configuration_file"
,
nargs
=
1
,
type
=
argparse
.
FileType
(),
parser
.
add_argument
(
"configuration_file"
,
nargs
=
1
,
type
=
argparse
.
FileType
(),
help
=
"Configuration file."
)
help
=
"Configuration file."
)
parser
.
add_argument
(
'-c'
,
'--console'
,
action
=
'store_true'
,
help
=
"Enable console output."
)
parser
.
add_argument
(
'-l'
,
'--logfile'
,
help
=
"Enable output into logfile."
)
if
args
:
if
args
:
parsed_argument
=
parser
.
parse_args
(
list
(
args
))
parsed_argument
=
parser
.
parse_args
(
list
(
args
))
else
:
else
:
parsed_argument
=
parser
.
parse_args
()
parsed_argument
=
parser
.
parse_args
()
logger
=
None
if
parsed_argument
.
console
or
parsed_argument
.
logfile
:
logger
=
logging
.
getLogger
(
'erp5testnode'
)
logger
.
setLevel
(
logging
.
INFO
)
if
parsed_argument
.
console
:
logger
.
addHandler
(
logging
.
StreamHandler
())
logger
.
info
(
'Activated console output.'
)
if
parsed_argument
.
logfile
:
logger
.
addHandler
(
logging
.
FileHandler
(
filename
=
parsed_argument
.
logfile
))
logger
.
info
(
'Activated logfile %r output'
%
parsed_argument
.
logfile
)
if
logger
is
not
None
:
CONFIG
[
'logger'
]
=
logger
.
info
config
=
ConfigParser
.
SafeConfigParser
()
config
=
ConfigParser
.
SafeConfigParser
()
# do not change case of option keys
# do not change case of option keys
config
.
optionxform
=
str
config
.
optionxform
=
str
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment