From owner-freebsd-hackers@freebsd.org Sun Dec 10 19:34:24 2017 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E384AE9855C for ; Sun, 10 Dec 2017 19:34:24 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from mr11p00im-asmtp003.me.com (mr11p00im-asmtp003.me.com [17.110.69.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C8DE67EA0D for ; Sun, 10 Dec 2017 19:34:24 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from process-dkim-sign-daemon.mr11p00im-asmtp003.me.com by mr11p00im-asmtp003.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) id <0P0R00G00BKBFQ00@mr11p00im-asmtp003.me.com> for freebsd-hackers@freebsd.org; Sun, 10 Dec 2017 18:33:13 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mac.com; s=04042017; t=1512930792; bh=LvLW696T7ZGQ4sZvK3NsadOJVAXyzBBGWH0LKZS7Z0o=; h=Date:Subject:From:To:Message-id:MIME-version:Content-type; b=hcSbWJhDtC3eqZRuQloFI9yd0SxqeLwYXH7Ftl0HYqfnwUu4dZQntbaFU2gQSiSRh z9cekvDFhaGiA2K9avVZdXepWv904M3AerI2LKWo2h9jSURL32S0tpitaWpaDlWHYV 8hDPOh8P1gnYyhsfLd9hDGKi/LVgWIS0Jvem5c3IHqfkSASuhfb4EXtyKYKzZzCbsU wEl4YKWE70IDTlMrBd9OoFD5kGio4QxI1AtsT8kJHOLndzO3D4PwJYk+QehV4GGe/m P5vvjUM3idUyh9Zj1mH7GuUv1tBZmnRNHTAhJtdhgx8AJPWUgPCrSTVR9tjQiDY8wQ lyzmVegNmOOXg== Received: from icloud.com ([127.0.0.1]) by mr11p00im-asmtp003.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) with ESMTPSA id <0P0R0049GCVB6C00@mr11p00im-asmtp003.me.com> for freebsd-hackers@freebsd.org; Sun, 10 Dec 2017 18:33:12 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-12-10_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1015 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1712100280 User-Agent: Microsoft-MacOutlook/f.28.0.171108 Date: Sun, 10 Dec 2017 10:33:10 -0800 Subject: Re: Hopefully useful: macro-controlled logger From: Ravi Pokala To: "freebsd-hackers@freebsd.org" Message-id: <75337BDB-3701-4215-974B-98C61997E145@mac.com> Thread-topic: Hopefully useful: macro-controlled logger MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 7bit X-Mailman-Approved-At: Sun, 10 Dec 2017 20:17:40 +0000 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Dec 2017 19:34:25 -0000 Hi Eric, > Date: Sat, 9 Dec 2017 11:52:10 -0500 > From: Eric McCorkle > To: "freebsd-hackers@freebsd.org" > Subject: Hopefully useful: macro-controlled logger > Message-ID: <0dd5240f-6c70-425f-7e98-7946097ea3ef@metricspace.net> > Content-Type: text/plain; charset=utf-8 > > Hi folks, > > ... > > Anyway, on a recent flight I decided to implement a macro-controlled > logging API in earnest. > > The github project can be found here: https://github.com/emc2/mcl > > ... 0) The README should be a bit more informative. ;-) 1) Since we're adding SPDX tags for licenses, you should do that too. ;-) 2) Thanks for proper (Doxygen? JavaDoc?) comments! I wish more files included at least a file-level overview of the type of stuff in the file. 3) Since LOG_LVL_ are integer values and not a bitmap, couldn't they be converted to an enum? That would also allow for adding new levels between existing levels, without having to re-number everything. 4) Hrm. Although that doesn't really help the fact that you'd still have to add the definition of the LOG_ macro. Since they're all the same, it would be nice if they too could be generated. But that's where you get into doing multiple levels of the preprocessor, and things can get incomprehensible fast. :-/ 5) I think LOG_SYSTEM is poor wording -- when I first read it, I assumed it meant for differentiating between logging via printf() or via log(); I think LOG_MODULE would more clearly communicate that it's for differentiating between software modules. 6) That having been said, it would be useful if there was a way to select the log output destination. I hope you find that feedback useful. -Ravi (rpokala@)