mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-24 17:28:08 +00:00
Use logging config to set destination of copyright info
This commit is contained in:
parent
23686215fe
commit
91fba4aca4
@ -97,23 +97,23 @@ def main():
|
||||
raise SystemExit
|
||||
|
||||
current_year = datetime.date.today().year
|
||||
if options.quiet:
|
||||
log.info("GNS3 server version {}".format(__version__))
|
||||
log.info("Copyright (c) 2007-{} GNS3 Technologies Inc.".format(current_year))
|
||||
else:
|
||||
print("GNS3 server version {}".format(__version__))
|
||||
print("Copyright (c) 2007-{} GNS3 Technologies Inc.".format(current_year))
|
||||
|
||||
user_log = logging.getLogger('user_facing')
|
||||
if not options.quiet:
|
||||
# Send user facing messages to stdout.
|
||||
stream_handler = logging.StreamHandler(sys.stdout)
|
||||
stream_handler.addFilter(logging.Filter(name='user_facing'))
|
||||
user_log.addHandler(stream_handler)
|
||||
user_log.propagate = False
|
||||
|
||||
user_log.info("GNS3 server version {}".format(__version__))
|
||||
user_log.info("Copyright (c) 2007-{} GNS3 Technologies Inc.".format(current_year))
|
||||
|
||||
# we only support Python 3 version >= 3.3
|
||||
if sys.version_info < (3, 3):
|
||||
raise RuntimeError("Python 3.3 or higher is required")
|
||||
|
||||
if options.quiet:
|
||||
log.info("Running with Python {major}.{minor}.{micro} and has PID {pid}".format(
|
||||
major=sys.version_info[0], minor=sys.version_info[1],
|
||||
micro=sys.version_info[2], pid=os.getpid()))
|
||||
else:
|
||||
print("Running with Python {major}.{minor}.{micro} and has PID {pid}".format(
|
||||
user_log.info("Running with Python {major}.{minor}.{micro} and has PID {pid}".format(
|
||||
major=sys.version_info[0], minor=sys.version_info[1],
|
||||
micro=sys.version_info[2], pid=os.getpid()))
|
||||
|
||||
|
@ -50,6 +50,7 @@ from .modules import MODULES
|
||||
import logging
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Server(object):
|
||||
|
||||
# built-in handlers
|
||||
@ -189,11 +190,8 @@ class Server(object):
|
||||
**settings) # FIXME: debug mode!
|
||||
|
||||
try:
|
||||
if self._quiet:
|
||||
log.info("Starting server on {}:{} (Tornado v{}, PyZMQ v{}, ZMQ v{})".format(
|
||||
self._host, self._port, tornado.version, zmq.__version__, zmq.zmq_version()))
|
||||
else:
|
||||
print("Starting server on {}:{} (Tornado v{}, PyZMQ v{}, ZMQ v{})".format(
|
||||
user_log = logging.getLogger('user_facing')
|
||||
user_log.info("Starting server on {}:{} (Tornado v{}, PyZMQ v{}, ZMQ v{})".format(
|
||||
self._host, self._port, tornado.version, zmq.__version__, zmq.zmq_version()))
|
||||
|
||||
kwargs = {"address": self._host}
|
||||
@ -233,10 +231,7 @@ class Server(object):
|
||||
try:
|
||||
ioloop.start()
|
||||
except (KeyboardInterrupt, SystemExit):
|
||||
if self._quiet:
|
||||
log.info("\nExiting...")
|
||||
else:
|
||||
print("\nExiting...")
|
||||
self._cleanup()
|
||||
|
||||
def _create_zmq_router(self):
|
||||
|
@ -23,5 +23,5 @@
|
||||
# or negative for a release candidate or beta (after the base version
|
||||
# number has been incremented)
|
||||
|
||||
__version__ = "1.0beta1"
|
||||
__version__ = "dev-gns-108-ca9d"
|
||||
__version_info__ = (1, 0, 0, -99)
|
||||
|
Loading…
Reference in New Issue
Block a user