當前位置: 首頁>>代碼示例>>Python>>正文


Python log.info方法代碼示例

本文整理匯總了Python中util.log.info方法的典型用法代碼示例。如果您正苦於以下問題:Python log.info方法的具體用法?Python log.info怎麽用?Python log.info使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在util.log的用法示例。


在下文中一共展示了log.info方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: router

# 需要導入模塊: from util import log [as 別名]
# 或者: from util.log import info [as 別名]
def router (args):
    if len(args) < 2:
        log.error('MM:00 ROUTER: ERROR: usage: router arg arg ...')
        return
    host = args[0]
    if host not in bgprouters:
        log.error('MM:' + host + ' ERROR: ' + 'ROUTER' + ' ' + host + ' : must be a BGP router')
        return
    del args[0]
    cmd = ''
    for arg in args:
        cmd += '"' + arg + '" '
    log.info('MM:' + host + ' ROUTER: ' + cmd)
    r = generic(host, 'ROUTER', 'router ' + cmd + '\n')
    if r is not None:
        log.debug('MM:' + host + ' ROUTER: output = \n' + r.strip())
        
# generic command interface to a tnode - send cmd, capture data
# return None id cannot connect or socket error
# return '' if no data 
開發者ID:sdn-ixp,項目名稱:iSDX,代碼行數:22,代碼來源:tmgr.py

示例2: send

# 需要導入模塊: from util import log [as 別名]
# 或者: from util.log import info [as 別名]
def send (args):
    if len(args) != 4:
        log.error('MM:00 SEND: ERROR usage: send source bind_addr dest_addr dest_port')
        return
    src = args[0]
    baddr = args[1]
    daddr = args[2]
    dport = args[3]
    if src not in hosts:
        log.error('MM:00 SEND: ERROR unknown src ' + src)
        return
    rand = str(random.randint(1000000000, 9999999999)) # must be 10 characters
    r = generic(src, 'TEST', 'test ' + rand + ' ' + baddr + ' ' + daddr + ' ' + str(dport) + '\n')
    if r is None:   # connection error
        return
    log.info('MM:' + src + ' SEND: ' + r.strip()) 
開發者ID:sdn-ixp,項目名稱:iSDX,代碼行數:18,代碼來源:tmgr.py

示例3: test

# 需要導入模塊: from util import log [as 別名]
# 或者: from util.log import info [as 別名]
def test (args):
    if len(args) == 0:
        print json.dumps(tests, indent=4, sort_keys=True)
        # log.error('MM:00 ERROR: TEST: usage: test test_name ...')
        return
    for arg in args:
        if arg not in tests:
            log.error('MM:00 ERROR: TEST: undefined test: ' + arg)
            return
    for arg in args:
        log.info('MM:00 INFO: TEST: ' + arg)
        for l in tests[arg]:
            parse(l)
    
# start listeners on one or more hosts, one or more ports
#listener                         all hosts, all ports
#listener host                    this host, all ports
#listener host bind port port     this host, this bind, these ports 
開發者ID:sdn-ixp,項目名稱:iSDX,代碼行數:20,代碼來源:tmgr.py

示例4: announce

# 需要導入模塊: from util import log [as 別名]
# 或者: from util.log import info [as 別名]
def announce (args):
    if len(args) < 2:
        log.error('MM:XX' + ' ERROR: usage: announce bgp_router network ...')
        return
    host = args[0]
    del args[0]
    nets = ''
    for arg in args:
        nets += ' ' + arg
    if host not in bgprouters:
        log.error('MM:' + host + ' ERROR: ' + 'ANNOUNCE' + ' ' + host + ' : must be a BGP router')
    log.info('MM:' + host + ' ANNOUNCE: ' + nets)
    r = generic(host, 'ANNOUNCE', 'announce ' + nets + '\n')
    if r is not None and len(r) > 0:
        log.info('MM:' + host + ' ANNOUNCE: ' + r.strip())
    
 
# withdraw a route 
開發者ID:sdn-ixp,項目名稱:iSDX,代碼行數:20,代碼來源:tmgr.py

示例5: withdraw

# 需要導入模塊: from util import log [as 別名]
# 或者: from util.log import info [as 別名]
def withdraw (args):
    if len(args) < 2:
        log.error('MM:XX' + ' ERROR: usage: withdraw bgp_router network ...')
        return
    host = args[0]
    del args[0]
    nets = ''
    for arg in args:
        nets += ' ' + arg
    if host not in bgprouters:
        log.error('MM:' + host + ' ERROR: ' + 'WITHDRAW' + ' ' + host + ' : must be a BGP router')
    log.info('MM:' + host + ' WITHDRAW: ' + nets)
    r = generic(host, 'WITHDRAW', 'withdraw ' + nets + '\n')
    if r is not None and len(r) > 0:
        log.info('MM:' + host + ' WITHDRAW: ' + r.strip())
        
# display bgp routes 
開發者ID:sdn-ixp,項目名稱:iSDX,代碼行數:19,代碼來源:tmgr.py

示例6: log_step_message

# 需要導入模塊: from util import log [as 別名]
# 或者: from util.log import info [as 別名]
def log_step_message(self, step, accuracy, d_loss, g_loss, 
                         s_loss, step_time, is_train=True):
        if step_time == 0: step_time = 0.001
        log_fn = (is_train and log.info or log.infov)
        log_fn((" [{split_mode:5s} step {step:4d}] " +
                "Supervised loss: {s_loss:.5f} " +
                "D loss: {d_loss:.5f} " +
                "G loss: {g_loss:.5f} " +
                "Accuracy: {accuracy:.5f} "
                "({sec_per_batch:.3f} sec/batch, {instance_per_sec:.3f} instances/sec) "
                ).format(split_mode=(is_train and 'train' or 'val'),
                         step = step,
                         d_loss = d_loss,
                         g_loss = g_loss,
                         s_loss = s_loss,
                         accuracy = accuracy,
                         sec_per_batch = step_time,
                         instance_per_sec = self.batch_size / step_time
                         )
               ) 
開發者ID:clvrai,項目名稱:SSGAN-Tensorflow,代碼行數:22,代碼來源:trainer.py

示例7: __call__

# 需要導入模塊: from util import log [as 別名]
# 或者: from util.log import info [as 別名]
def __call__(self, input):
        with tf.variable_scope(self.name, reuse=self._reuse):
            if not self._reuse:
                print('\033[93m'+self.name+'\033[0m')
            _ = input
            num_channel = [32, 64, 128, 256, 256, 512]
            num_layer = np.ceil(np.log2(min(_.shape.as_list()[1:3]))).astype(np.int)
            for i in range(num_layer):
                ch = num_channel[i] if i < len(num_channel) else 512
                _ = conv2d(_, ch, self._is_train, info=not self._reuse,
                           norm=self._norm_type, name='conv{}'.format(i+1))
            _ = conv2d(_, int(num_channel[i]/4), self._is_train, k=1, s=1,
                       info=not self._reuse, norm='None', name='conv{}'.format(i+2))
            _ = conv2d(_, self._num_class+1, self._is_train, k=1, s=1, info=not self._reuse,
                       activation_fn=None, norm='None',
                       name='conv{}'.format(i+3))
            _ = tf.squeeze(_)
            if not self._reuse: 
                log.info('discriminator output {}'.format(_.shape.as_list()))
            self._reuse = True
            self.var_list = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES, self.name)
            return tf.nn.sigmoid(_), _ 
開發者ID:clvrai,項目名稱:SSGAN-Tensorflow,代碼行數:24,代碼來源:discriminator.py

示例8: log_step_message

# 需要導入模塊: from util import log [as 別名]
# 或者: from util.log import info [as 別名]
def log_step_message(self, step, loss, loss_g_update,
                         loss_z_update, step_time, is_train=True):
        if step_time == 0:
            step_time = 0.001
        log_fn = (is_train and log.info or log.infov)
        log_fn((" [{split_mode:5s} step {step:4d}] " +
                "Loss: {loss:.5f} " +
                "G update: {loss_g_update:.5f} " +
                "Z update: {loss_z_update:.5f} " +
                "({sec_per_batch:.3f} sec/batch, {instance_per_sec:.3f} instances/sec) "
                ).format(split_mode=(is_train and 'train' or 'val'),
                         step=step,
                         loss=loss,
                         loss_z_update=loss_z_update,
                         loss_g_update=loss_g_update,
                         sec_per_batch=step_time,
                         instance_per_sec=self.batch_size / step_time
                         )
               ) 
開發者ID:clvrai,項目名稱:Generative-Latent-Optimization-Tensorflow,代碼行數:21,代碼來源:trainer.py

示例9: __init__

# 需要導入模塊: from util import log [as 別名]
# 或者: from util.log import info [as 別名]
def __init__(self, ids, name='default',
                 max_examples=None, is_train=True):
        self._ids = list(ids)
        self.name = name
        self.is_train = is_train

        if max_examples is not None:
            self._ids = self._ids[:max_examples]

        filename = 'data.hdf5'

        file = os.path.join(__PATH__, filename)
        log.info("Reading %s ...", file)

        try:
            self.data = h5py.File(file, 'r+')
        except:
            raise IOError('Dataset not found. Please make sure the dataset was downloaded.')
        log.info("Reading Done: %s", file) 
開發者ID:clvrai,項目名稱:Generative-Latent-Optimization-Tensorflow,代碼行數:21,代碼來源:svhn.py

示例10: log_step_message

# 需要導入模塊: from util import log [as 別名]
# 或者: from util.log import info [as 別名]
def log_step_message(self, step, loss, loss_pair,
                         loss_unpair, step_time, is_train=True):
        if step_time == 0:
            step_time = 0.001
        log_fn = (is_train and log.info or log.infov)
        log_fn((" [{split_mode:5s} step {step:4d}] " +
                "Loss: {loss:.5f} " +
                "Loss pair: {loss_pair:.5f} " +
                "Loss unpair: {loss_unpair:.5f} " +
                "({sec_per_batch:.3f} sec/batch, {instance_per_sec:.3f} instances/sec) "
                ).format(split_mode=(is_train and 'train' or 'val'),
                         step=step,
                         loss=loss,
                         loss_pair=loss_pair,
                         loss_unpair=loss_unpair,
                         sec_per_batch=step_time,
                         instance_per_sec=self.batch_size / step_time
                         )
               ) 
開發者ID:clvrai,項目名稱:Representation-Learning-by-Learning-to-Count,代碼行數:21,代碼來源:trainer.py

示例11: __init__

# 需要導入模塊: from util import log [as 別名]
# 或者: from util.log import info [as 別名]
def __init__(self, ids, name='default',
                 max_examples=None, is_train=True):
        self._ids = list(ids)
        self.name = name
        self.is_train = is_train

        if max_examples is not None:
            self._ids = self._ids[:max_examples]

        file = os.path.join(__IMAGENET_IMG_PATH__, self._ids[0])

        try:
            imread(file)
        except:
            raise IOError('Dataset not found. Please make sure the dataset was downloaded.')
        log.info("Reading Done: %s", file) 
開發者ID:clvrai,項目名稱:Representation-Learning-by-Learning-to-Count,代碼行數:18,代碼來源:ImageNet.py

示例12: log_step_message

# 需要導入模塊: from util import log [as 別名]
# 或者: from util.log import info [as 別名]
def log_step_message(self, step, loss, accuracy, step_time, is_train=True):
        if step_time == 0:
            step_time = 0.001
        log_fn = (is_train and log.info or log.infov)
        log_fn((" [{split_mode:5s} step {step:4d}] " +
                "Loss: {loss:.5f} " +
                "Accuracy: {accuracy:.5f} " +
                "({sec_per_batch:.3f} sec/batch, {instance_per_sec:.3f} instances/sec) "
                ).format(split_mode=(is_train and 'train' or 'val'),
                         step=step,
                         loss=loss,
                         accuracy=accuracy,
                         sec_per_batch=step_time,
                         instance_per_sec=self.batch_size / step_time
                         )
               ) 
開發者ID:clvrai,項目名稱:Representation-Learning-by-Learning-to-Count,代碼行數:18,代碼來源:trainer_classifier.py

示例13: log_step_message

# 需要導入模塊: from util import log [as 別名]
# 或者: from util.log import info [as 別名]
def log_step_message(self, step, p_loss, f_loss, loss, step_time, is_train=True):
        if step_time == 0: step_time = 0.001
        log_fn = (is_train and log.info or log.infov)
        log_fn((" [{split_mode:5s} step {step:4d}] " +
                "Loss: {loss:.5f} " +
                "Pixel loss: {p_loss:.5f} " +
                "Flow loss: {f_loss:.5f} " +
                "({sec_per_batch:.3f} sec/batch, {instance_per_sec:.3f} instances/sec) "
                ).format(split_mode=(is_train and 'train' or 'val'),
                         step=step,
                         loss=loss,
                         p_loss=p_loss,
                         f_loss=f_loss,
                         sec_per_batch=step_time,
                         instance_per_sec=self.batch_size / step_time
                         )
               ) 
開發者ID:shaohua0116,項目名稱:Multiview2Novelview,代碼行數:19,代碼來源:trainer.py

示例14: __init__

# 需要導入模塊: from util import log [as 別名]
# 或者: from util.log import info [as 別名]
def __init__(self, ids, n, scene_class, name='default',
                 max_examples=None, is_train=True, bound=10):
        self._ids = list(ids)
        self.name = name
        self.is_train = is_train
        self.n = n
        self.bound = bound

        if max_examples is not None:
            self._ids = self._ids[:max_examples]

        filename = 'data_{}.hdf5'.format(scene_class)

        file = osp.join('./datasets/{}'.format(scene_class), filename)
        log.info("Reading %s ...", file)

        self.data = h5py.File(file, 'r')
        log.info("Reading Done: %s", file) 
開發者ID:shaohua0116,項目名稱:Multiview2Novelview,代碼行數:20,代碼來源:scene_loader.py

示例15: __init__

# 需要導入模塊: from util import log [as 別名]
# 或者: from util.log import info [as 別名]
def __init__(self, ids, n, object_class, name='default',
                 max_examples=None, is_train=True):
        self._ids = list(ids)
        self.name = name
        self.is_train = is_train
        self.n = n
        self.bound = int(360/ang_interval+1)

        if max_examples is not None:
            self._ids = self._ids[:max_examples]

        filename = 'data_{}.hdf5'.format(object_class)

        file = osp.join(__PATH__, filename)
        log.info("Reading %s ...", file)

        self.data = h5py.File(file, 'r')
        log.info("Reading Done: %s", file) 
開發者ID:shaohua0116,項目名稱:Multiview2Novelview,代碼行數:20,代碼來源:object_loader.py


注:本文中的util.log.info方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。