Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
kamaki
Commits
db8d1766
Commit
db8d1766
authored
Dec 17, 2012
by
Stavros Sachtouris
Browse files
Introduce warning logger
parent
365280ca
Changes
3
Hide whitespace changes
Inline
Side-by-side
kamaki/cli/__init__.py
View file @
db8d1766
...
...
@@ -179,18 +179,21 @@ def _setup_logging(silent=False, debug=False, verbose=False, include=False):
if
silent
:
add_handler
(
''
,
logging
.
CRITICAL
)
elif
debug
:
return
if
debug
:
add_handler
(
'requests'
,
logging
.
INFO
,
prefix
=
'* '
)
add_handler
(
'clients.send'
,
logging
.
DEBUG
,
prefix
=
'> '
)
add_handler
(
'clients.recv'
,
logging
.
DEBUG
,
prefix
=
'< '
)
add_handler
(
'kamaki'
,
logging
.
DEBUG
,
prefix
=
'[DEBUG]: '
)
elif
verbose
:
add_handler
(
'requests'
,
logging
.
INFO
,
prefix
=
'* '
)
add_handler
(
'clients.send'
,
logging
.
INFO
,
prefix
=
'> '
)
add_handler
(
'clients.recv'
,
logging
.
INFO
,
prefix
=
'< '
)
add_handler
(
'kamaki'
,
logging
.
INFO
,
prefix
=
'[INFO]: '
)
elif
include
:
add_handler
(
'clients.recv'
,
logging
.
INFO
)
else
:
add_handler
(
''
,
logging
.
WARNING
)
add_handler
(
'kamaki'
,
logging
.
WARNING
,
prefix
=
'[WARNING]: '
)
def
_init_session
(
arguments
):
...
...
kamaki/cli/argument.py
View file @
db8d1766
...
...
@@ -34,6 +34,8 @@
from
kamaki.cli.config
import
Config
from
kamaki.cli.errors
import
CLISyntaxError
,
raiseCLIError
from
kamaki.cli.utils
import
split_input
from
logging
import
getLogger
from
argparse
import
ArgumentParser
,
ArgumentError
...
...
@@ -43,6 +45,8 @@ except ImportError:
# progress not installed - pls, pip install progress
pass
kloger
=
logging
.
getLogger
(
'kamaki.warning'
)
class
Argument
(
object
):
"""An argument that can be parsed from command line or otherwise.
...
...
@@ -288,7 +292,7 @@ class ProgressBarArgument(FlagArgument):
try
:
KamakiProgressBar
except
NameError
:
print
(
'W
arning
:
no progress bar functionality'
)
kloger
.
w
arning
(
'
no progress bar functionality'
)
def
clone
(
self
):
"""Get a modifiable copy of this bar"""
...
...
kamaki/clients/__init__.py
View file @
db8d1766
...
...
@@ -198,7 +198,7 @@ class Client(object):
sendlog
.
info
(
'
\t
%s: %s'
,
key
,
val
)
sendlog
.
info
(
''
)
if
data
:
sendlog
.
info
(
'%s'
,
data
)
sendlog
.
debug
(
'%s'
,
data
)
recvlog
.
info
(
'%d %s'
,
r
.
status_code
,
r
.
status
)
for
key
,
val
in
r
.
headers
.
items
():
...
...
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