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
61ca0ecd
Commit
61ca0ecd
authored
Mar 22, 2013
by
Stavros Sachtouris
Browse files
Create get_logger, add_logger methods in clients
parent
59f71e99
Changes
2
Hide whitespace changes
Inline
Side-by-side
kamaki/clients/__init__.py
View file @
61ca0ecd
...
...
@@ -35,15 +35,16 @@ from urllib2 import quote
from
threading
import
Thread
from
json
import
dumps
,
loads
from
time
import
time
import
logging
from
kamaki.clients.utils
import
get_logger
from
kamaki.clients.connection.kamakicon
import
KamakiHTTPConnection
from
kamaki.clients.connection.errors
import
KamakiConnectionError
from
kamaki.clients.connection.errors
import
KamakiResponseError
sendlog
=
logging
.
get
L
ogger
(
'clients.send'
)
datasendlog
=
logging
.
get
L
ogger
(
'data.send'
)
recvlog
=
logging
.
get
L
ogger
(
'clients.recv'
)
datarecvlog
=
logging
.
get
L
ogger
(
'data.recv'
)
sendlog
=
get
_l
ogger
(
'clients.send'
)
datasendlog
=
get
_l
ogger
(
'data.send'
)
recvlog
=
get
_l
ogger
(
'clients.recv'
)
datarecvlog
=
get
_l
ogger
(
'data.recv'
)
class
ClientError
(
Exception
):
...
...
kamaki/clients/utils/__init__.py
View file @
61ca0ecd
...
...
@@ -31,6 +31,21 @@
# interpreted as representing official policies, either expressed
# or implied, of GRNET S.A.
import
logging
def
add_logger
(
name
,
level
,
prefix
=
''
):
h
=
logging
.
StreamHandler
()
fmt
=
logging
.
Formatter
(
prefix
+
'%(message)s'
)
h
.
setFormatter
(
fmt
)
logger
=
logging
.
getLogger
(
name
)
logger
.
addHandler
(
h
)
logger
.
setLevel
(
level
)
def
get_logger
(
name
):
return
logging
.
getLogger
(
name
)
def
_matches
(
val1
,
val2
,
exactMath
=
True
):
"""Case Insensitive match"""
...
...
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