def __init__(self, name, fd): Sink.__init__(self, name) if fd == 'stdout': fd = sys.stdout if fd == 'stderr': fd = sys.stderr self.fd = fd
def __init__(self, name, endpoint, identity=None, bind=False): Sink.__init__(self, name) self.endpoint = endpoint self.identity = identity self.context = zmq.Context() self.socket = self.context.socket(zmq.PUSH) if bind: log.debug('%s: Binding socket to %s' % (self, endpoint)) self.socket.bind(endpoint) else: log.debug('%s: Connecting socket to %s' % (self, endpoint)) self.socket.connect(endpoint)
def __init__(self, name, path, fmt='{dt.year:04}/{dt.month:02}/{dt.day:02}/{key}.log', msgfmt='{key}:{ts}:{message}\n', sync=False, **kwargs): Sink.__init__(self, name) self.path = path self.fmt = fmt self.msgfmt = msgfmt self.sync = sync self.kwargs = kwargs self.openfiles = {} if not os.path.exists(path): os.makedirs(path) if not os.path.isdir(path): raise Exception('%s is not a directory!' % path)