Commit b4feb441 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Use same log format for all NEO applications and define it in the root module.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@652 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 773ec228
DEFAULT_LOG_FORMAT = '[%(module)12s:%(lineno)3d] %(message)s'
......@@ -24,6 +24,7 @@ from neo.client.app import Application
from neo.client.exception import NEOStorageConflictError, NEOStorageNotFoundError
from neo.util import dump
from neo.locking import Lock
from neo import DEFAULT_LOG_FORMAT
class Storage(BaseStorage.BaseStorage,
ConflictResolution.ConflictResolvingStorage):
......@@ -33,8 +34,7 @@ class Storage(BaseStorage.BaseStorage,
def __init__(self, master_nodes, name, connector, read_only=False, **kw):
self._is_read_only = read_only
format='[%(module)12s:%(lineno)3d] %(message)s'
logging.basicConfig(level=logging.DEBUG, format=format)
logging.basicConfig(level=logging.DEBUG, format=DEFAULT_LOG_FORMAT)
# Transaction must be under protection of lock
self.app = Application(master_nodes, name, connector)
......
......@@ -20,6 +20,7 @@
from optparse import OptionParser
from neo.admin.app import Application
from neo import DEFAULT_LOG_FORMAT
import logging
parser = OptionParser()
parser.add_option('-v', '--verbose', action = 'store_true',
......@@ -35,10 +36,9 @@ section = options.section or 'admin'
logfile = options.logfile or None
if options.verbose:
logging.basicConfig(filename = logfile, level = logging.INFO)
logging.basicConfig(level=logging.DEBUG, format=DEFAULT_LOG_FORMAT)
else:
logging.basicConfig(filename = logfile, level = logging.WARNING)
logging.basicConfig(level=logging.INFO, format=DEFAULT_LOG_FORMAT)
app = Application(config, section)
app.run()
......@@ -20,6 +20,7 @@
from optparse import OptionParser
from neo.neoctl.app import Application
from neo import DEFAULT_LOG_FORMAT
import logging
parser = OptionParser()
parser.add_option('-v', '--verbose', action = 'store_true',
......@@ -35,10 +36,11 @@ port = options.port or 5555
ip = options.ip or '127.0.0.1'
handler = options.handler or "SocketConnector"
format='[%(module)12s:%(lineno)3d] %(message)s'
if options.verbose:
logging.basicConfig(level = logging.DEBUG)
logging.basicConfig(level=logging.DEBUG, format=DEFAULT_LOG_FORMAT)
else:
logging.basicConfig(level = logging.INFO)
logging.basicConfig(level=logging.INFO, format=DEFAULT_LOG_FORMAT)
app = Application(ip, port, handler)
......
......@@ -20,6 +20,7 @@
from optparse import OptionParser
from neo.master.app import Application
from neo import DEFAULT_LOG_FORMAT
import logging
......@@ -38,9 +39,9 @@ logfile = options.logfile or None
format='[%(module)12s:%(lineno)3d] %(message)s'
if options.verbose:
logging.basicConfig(filename=logfile, level=logging.DEBUG, format=format)
logging.basicConfig(filename=logfile, level=logging.DEBUG, format=DEFAULT_LOG_FORMAT)
else:
logging.basicConfig(filename=logfile, level=logging.WARNING, format=format)
logging.basicConfig(filename=logfile, level=logging.WARNING, format=DEFAULT_LOG_FORMAT)
app = Application(config, section)
app.run()
......@@ -20,6 +20,7 @@
from optparse import OptionParser
from neo.storage.app import Application
from neo import DEFAULT_LOG_FORMAT
import logging
......@@ -40,9 +41,9 @@ logfile = options.logfile or None
format='[%(module)12s:%(lineno)3d] %(message)s'
if options.verbose:
logging.basicConfig(filename=logfile, level=logging.DEBUG, format=format)
logging.basicConfig(filename=logfile, level=logging.DEBUG, format=DEFAULT_LOG_FORMAT)
else:
logging.basicConfig(filename=logfile, level=logging.WARNING, format=format)
logging.basicConfig(filename=logfile, level=logging.WARNING, format=DEFAULT_LOG_FORMAT)
app = Application(config, section, options.reset)
app.run()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment