Let's not go ahead with this particular one. There is another github PR (WIP), that has DBG function too, and other things that use that. Hopefully, I will complete it over this weekend.
Get Outlook for iOS<https://aka.ms/o0ukef> ________________________________ From: [email protected] <[email protected]> on behalf of Yifeng Sun <[email protected]> Sent: Friday, May 11, 2018 7:16:55 PM To: Ben Pfaff Cc: ovs dev Subject: Re: [ovs-dev] [PATCH] ovn/utilities: add info and warn level log functions Looks good to me, thanks. Reviewed-by: Yifeng Sun <[email protected]> On Sun, Apr 29, 2018 at 2:02 PM, Ben Pfaff <[email protected]> wrote: > From: Paul Greenberg <[email protected]> > > There is no INFO or WARN level log function. It is either ERROR or > FATAL. This PR adds it. > > Signed-off-by: Paul Greenberg <[email protected]> > Submitted-at: https://github.com/openvswitch/ovs/pull/229 > --- > Posting to ovs-dev so that it gets reviewed. > > ovn/utilities/ovn-docker-overlay-driver.in | 14 ++++++++++++++ > python/ovs/util.py | 28 > ++++++++++++++++++++++++++++ > 2 files changed, 42 insertions(+) > > diff --git a/ovn/utilities/ovn-docker-overlay-driver.in b/ovn/utilities/ > ovn-docker-overlay-driver.in > index 65edfcd9d19e..28778d1e5263 100755 > --- a/ovn/utilities/ovn-docker-overlay-driver.in > +++ b/ovn/utilities/ovn-docker-overlay-driver.in > @@ -110,6 +110,7 @@ def prepare(): > fo = open(PLUGIN_FILE, "w") > fo.write("tcp://0.0.0.0:5000") > fo.close() > + ovs.util.ovs_info("configuration file: %s" % (PLUGIN_FILE), vlog) > except Exception as e: > ovs.util.ovs_fatal(0, "Failed to write to spec file (%s)" % > str(e), > vlog) > @@ -437,6 +438,19 @@ def network_leave(): > > return jsonify({}) > > [email protected]('/', defaults={'path': ''}) > [email protected]('/<path:path>') > +def unsupported_libnetwork_call(path): > + ''' > + This function handles any new endpoints that are being added to > + Docker libnetwork remote network plugin API. If this function receives > + a request and that request is valid, there is a need to refactor > + this plugin, because a new functionality is being introduced. > + ''' > + ovs.util.ovs_warn("received unsupported libnetwork %s request to: %s, > with payload: %s" % (request.method, request.path, request.data), vlog) > + > + return jsonify({}) > + > if __name__ == '__main__': > prepare() > app.run(host='0.0.0.0') > diff --git a/python/ovs/util.py b/python/ovs/util.py > index 411ac99c85a4..13a34d8c302b 100644 > --- a/python/ovs/util.py > +++ b/python/ovs/util.py > @@ -93,3 +93,31 @@ def ovs_fatal(*args, **kwargs): > > ovs_error(*args, **kwargs) > sys.exit(1) > + > + > +def ovs_info(message, vlog=None): > + """Prints 'message' on stdout and emits an INFO level log message to > + 'vlog' if supplied. > + > + 'message' should not end with a new-line, because this function will > add > + one itself.""" > + > + info_msg = "%s: %s" % (PROGRAM_NAME, message) > + > + sys.stdout.write("%s\n" % info_msg) > + if vlog: > + vlog.info(info_msg) > + > + > +def ovs_warn(message, vlog=None): > + """Prints 'message' on stdout and emits an WARN level log message to > + 'vlog' if supplied. > + > + 'message' should not end with a new-line, because this function will > add > + one itself.""" > + > + info_msg = "%s: %s" % (PROGRAM_NAME, message) > + > + sys.stdout.write("%s\n" % info_msg) > + if vlog: > + vlog.warn(info_msg) > -- > 2.16.1 > > _______________________________________________ > dev mailing list > [email protected] > https://mail.openvswitch.org/mailman/listinfo/ovs-dev > _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
