Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
settingsd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
settingsd
Commits
50bcafea
Commit
50bcafea
authored
Sep 06, 2010
by
Devaev Maxim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug with logging, added tracer for dbus API
parent
e4a3f944
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
5 deletions
+20
-5
main.conf
configs/main.conf
+1
-0
config.py
settingsd/config.py
+2
-2
logger.py
settingsd/logger.py
+1
-0
service.py
settingsd/service.py
+15
-1
validators.py
settingsd/validators.py
+1
-2
No files found.
configs/main.conf
View file @
50bcafea
[
service
]
bus_type
=
session
log_level
=
2
[
hello
]
enabled
=
yes
settingsd/config.py
View file @
50bcafea
...
...
@@ -15,7 +15,7 @@ ConfigDictObject = {
"name"
:
(
const
.
DEFAULT_SERVICE_NAME
,
str
),
"path"
:
(
const
.
DEFAULT_SERVICE_PATH
,
str
),
"bus_type"
:
(
const
.
DEFAULT_SERVICE_BUS_TYPE
,
(
lambda
arg
:
validators
.
validRange
(
arg
,
const
.
ALL_SERVICE_BUS_TYPES_LIST
)
)),
"log_level"
:
(
const
.
DEFAULT_LOG_LEVEL
,
(
lambda
arg
:
int
(
validators
.
validRange
(
arg
,
const
.
ALL_LOG_LEVELS_LIST
)
)
))
"log_level"
:
(
const
.
DEFAULT_LOG_LEVEL
,
(
lambda
arg
:
validators
.
validRange
(
int
(
arg
),
const
.
ALL_LOG_LEVELS_LIST
)
))
}
}
...
...
@@ -34,7 +34,7 @@ def setValue(section, option, value, validator = None) :
try
:
value
=
validator
(
value
)
except
Exception
,
err1
:
raise
validators
.
ValidatorError
(
"Incorrect config option
\"
%
s ::
%
s =
%
s
\"
"
%
(
section
,
option
,
value
,
str
(
err1
)))
raise
validators
.
ValidatorError
(
"Incorrect config option
\"
%
s ::
%
s =
%
s
\"
:
%
s
"
%
(
section
,
option
,
value
,
str
(
err1
)))
ConfigDictObject
[
section
][
option
]
=
(
value
,
validator
)
...
...
settingsd/logger.py
View file @
50bcafea
...
...
@@ -14,6 +14,7 @@ def message(log_level, message) :
"
%
s [ Details ]:"
%
(
const
.
MY_NAME
),
# const.LOG_LEVEL_VERBOSE == 1
"
%
s [ Debug ]:"
%
(
const
.
MY_NAME
)
# # const.LOG_LEVEL_DEBUG == 2
]
if
log_level
<=
config
.
value
(
"service"
,
"log_level"
)
:
print
>>
sys
.
stderr
,
text_log_levels_list
[
log_level
],
message
settingsd/service.py
View file @
50bcafea
...
...
@@ -5,9 +5,11 @@ import dbus.service
import
dbus.glib
import
abc
import
const
import
config
import
shared
import
dbus_tools
import
logger
#####
...
...
@@ -57,9 +59,21 @@ class ActionObject(CustomObject) :
######
def
tracer
(
function
)
:
def
wrapper
(
self
,
*
args_list
,
**
kwargs_dict
)
:
return_value
=
function
(
self
,
*
args_list
,
**
kwargs_dict
)
logger
.
message
(
const
.
LOG_LEVEL_DEBUG
,
"Called
\"
%
s::
%
s
\"
with args (
%
s,
%
s) -->
%
s"
%
(
self
.
__class__
.
__name__
,
function
.
__name__
,
str
(
args_list
),
str
(
kwargs_dict
),
str
(
return_value
)
))
return
return_value
wrapper
.
__dict__
=
function
.
__dict__
wrapper
.
__name__
=
function
.
__name__
return
wrapper
def
customMethod
(
interface_name
)
:
def
decorator
(
function
)
:
return
dbus
.
service
.
method
(
interface_name
)(
function
)
return
tracer
(
dbus
.
service
.
method
(
interface_name
)(
function
)
)
return
decorator
def
functionMethod
(
interface_name
)
:
...
...
settingsd/validators.py
View file @
50bcafea
...
...
@@ -20,6 +20,5 @@ def validBool(arg) :
def
validRange
(
arg
,
valid_args_list
)
:
if
not
arg
in
valid_args_list
:
raise
ValidatorError
(
"Argument
\"
%
s
\"
not in list
%
s"
%
(
arg
,
valid_args_list
))
return
(
arg
in
valid_args_list
)
return
arg
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