All Samples(2522) | Call(2494) | Derive(0) | Import(28)
Do basic configuration for the logging system.
This function does nothing if the root logger already has handlers
configured. It is a convenience method intended for use by simple scripts
to do one-shot configuration of the logging package.
The default behaviour is to create a StreamHandler which writes to
sys.stderr, set a formatter using the BASIC_FORMAT format string, and
add the handler to the root logger.
A number of optional keyword arguments may be specified, which can alter
the default behaviour.
filename Specifies that a FileHandler be created, using the specified
filename, rather than a StreamHandler.
filemode Specifies the mode to open the file, if filename is specified
(if filemode is unspecified, it defaults to 'a').
format Use the specified format string for the handler.
datefmt Use the specified date/time format.
level Set the root logger level to the specified level.
stream Use the specified stream to initialize the StreamHandler. Note
that this argument is incompatible with 'filename' - if both
are present, 'stream' is ignored.
Note that you could specify a stream created using open(filename, mode)
rather than passing the filename and mode in. However, it should be
remembered that StreamHandler does not close its stream (since it may be
using sys.stdout or sys.stderr), whereas FileHandler closes its stream
when the handler is closed.
def basicConfig(**kwargs):
"""
Do basic configuration for the logging system.
This function does nothing if the root logger already has handlers
configured. It is a convenience method intended for use by simple scripts
to do one-shot configuration of the logging package.
The default behaviour is to create a StreamHandler which writes to
sys.stderr, set a formatter using the BASIC_FORMAT format string, and
add the handler to the root logger.
A number of optional keyword arguments may be specified, which can alter
the default behaviour.
filename Specifies that a FileHandler be created, using the specified
filename, rather than a StreamHandler.
filemode Specifies the mode to open the file, if filename is specified
(if filemode is unspecified, it defaults to 'a').
format Use the specified format string for the handler.
datefmt Use the specified date/time format.
level Set the root logger level to the specified level.
stream Use the specified stream to initialize the StreamHandler. Note
that this argument is incompatible with 'filename' - if both
are present, 'stream' is ignored.
Note that you could specify a stream created using open(filename, mode)
rather than passing the filename and mode in. However, it should be
remembered that StreamHandler does not close its stream (since it may be
using sys.stdout or sys.stderr), whereas FileHandler closes its stream
when the handler is closed.
"""
if len(root.handlers) == 0:
filename = kwargs.get("filename")
if filename:
mode = kwargs.get("filemode", 'a')
hdlr = FileHandler(filename, mode)
else:
stream = kwargs.get("stream")
hdlr = StreamHandler(stream)
fs = kwargs.get("format", BASIC_FORMAT)
dfs = kwargs.get("datefmt", None)
fmt = Formatter(fs, dfs)
hdlr.setFormatter(fmt)
root.addHandler(hdlr)
level = kwargs.get("level")
if level is not None:
root.setLevel(level)
import log from ConfigParser import ConfigParser from os.path import isfile from logging import basicConfig, INFO, DEBUG def options(config=None, framework_config=None):
datefmt = config['log_datefmt']
basicConfig(
level = level,
format = log_format,
datefmt = datefmt)
src/l/e/LEPL-4.3.2/src/lepl/_example/trace.py LEPL(Download)
''' from logging import basicConfig, INFO, DEBUG from lepl import *
src/l/e/LEPL-4.3.2/src/lepl/offside/_example/offside.py LEPL(Download)
#@PydevCodeAnalysisIgnore from logging import basicConfig, DEBUG from lepl import * from lepl._example.support import Example
src/l/e/LEPL-4.3.2/src/lepl/offside/_example/line_aware.py LEPL(Download)
#@PydevCodeAnalysisIgnore from logging import basicConfig, DEBUG from lepl import * from lepl._example.support import Example
src/l/e/LEPL-4.3.2/src/lepl/_example/phone.py LEPL(Download)
Examples from the documentation. ''' from logging import basicConfig, DEBUG from lepl import * from lepl._example.support import Example
src/l/e/LEPL-4.3.2/src/lepl/_example/performance.py LEPL(Download)
Examples from the documentation. ''' from logging import basicConfig, DEBUG from gc import collect from random import random
src/p/y/pyload-HEAD/Core.py pyload(Download)
from os import sep, chdir, mkdir, curdir, name, system, remove from os.path import exists, abspath, dirname, basename from sys import path, exit from logging import warning, basicConfig import urllib2 import re from time import sleep, time
from module.thread_list import Thread_List
from module.Py_Load_File import PyLoadFile
basicConfig(filename='Logs/faild.txt', format = '%(message)s')
class Core(object):
""" pyLoad main
src/p/y/python-bittorrent-HEAD/tracker.py python-bittorrent(Download)
# pytorrent-tracker.py # A bittorrent tracker from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer from threading import Thread from logging import basicConfig, info, INFO from pickle import dump, load
self.server_class.interval = interval # Set logging info basicConfig(filename = log, level = INFO) # If not in memory, give the database a file, otherwise it # will stay in memory
src/o/r/ordf-0.14/ordf/vocab/opencyc.py ordf(Download)
yield ancestor
if __name__ == '__main__':
from logging import basicConfig, DEBUG
basicConfig(level=DEBUG)
import doctest
src/f/t/ftf-HEAD/tulip/trunk/perform_test.py ftf(Download)
from datetime import datetime from logging import basicConfig as loggerBasicConfig from logging import log as logger from logging import DEBUG from logging import INFO
name, report_server, is_ready, logging_level = get_project_name(test_id)
if logging_level == 'debug':
loggerBasicConfig(level=DEBUG,
format='%(asctime)s %(levelname)s %(message)s',)
else:
loggerBasicConfig(level=INFO,
1 | 2 | 3 Next