Remove logger from dataset, it's not necessary, as there's only one call location that wants to say something. Turn that into an exception instead
This commit is contained in:
@ -8,19 +8,13 @@ from __future__ import (
|
|||||||
|
|
||||||
import time
|
import time
|
||||||
import agentx
|
import agentx
|
||||||
import logging
|
|
||||||
|
|
||||||
|
class DataSetError(Exception):
|
||||||
class NullHandler(logging.Handler):
|
|
||||||
def emit(self, record):
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class DataSet():
|
class DataSet():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._data = {}
|
self._data = {}
|
||||||
self.logger = logging.getLogger('agentx.dataset')
|
|
||||||
self.logger.addHandler(NullHandler())
|
|
||||||
|
|
||||||
def set(self, oid, oid_type, value):
|
def set(self, oid, oid_type, value):
|
||||||
if oid_type.startswith('int'):
|
if oid_type.startswith('int'):
|
||||||
@ -42,7 +36,7 @@ class DataSet():
|
|||||||
elif oid_type == 'counter64' or oid_type == 'uint64' or oid_type == 'u64':
|
elif oid_type == 'counter64' or oid_type == 'uint64' or oid_type == 'u64':
|
||||||
t = agentx.TYPE_COUNTER64
|
t = agentx.TYPE_COUNTER64
|
||||||
else:
|
else:
|
||||||
self.logger.error('Invalid oid_type: %s' % (oid_type))
|
raise DataSetErrror('Invalid oid_type: %s' % (oid_type))
|
||||||
return
|
return
|
||||||
|
|
||||||
self._data[oid] = {
|
self._data[oid] = {
|
||||||
|
Reference in New Issue
Block a user