Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!lightspeed.eweka.nl!lightspeed.eweka.nl!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:not': 0.03; 'api.': 0.05; '"""': 0.07; '*args,': 0.09; 'indication': 0.09; 'def': 0.12; 'assume': 0.14; 'args,': 0.16; 'logger': 0.16; 'subject:Logging': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'feb': 0.22; 'appears': 0.22; 'error': 0.23; "shouldn't": 0.24; 'header :In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'subject:with': 0.35; 'received:209.85': 0.35; 'received:209.85.220': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'method': 0.36; 'level': 0.37; 'received:209': 0.37; 'performance': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; '2015': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=XxU2IKU96Cxf8FC7A1Im842t74Q7yZ2j6yNNbUp8Aw8=; b=k3MrZsG9SO6ueqoDB8AjGFlVINPbgymx0KO77SPQOEcnV2Ps71dNUPynE6x+couTa/ RLJ582FHZOwv8Q1qj2kinritbyp79Ktxn6uyhsAQ8Xz8b+Q8LdFmyDyC8vMSKxDEuwp5 j1n5yVr3wLjiETWw0GeKVGaG9hIAGNBzjfngraKcY5WHII3B55yooFbVByVOOl7DwVNP wz9jZ5FfVwVIifwuRLfDI1Up/AR0giiQydUvU2RhX5MPMDMl7mkvNgXBFNIivldWxlxk rIIjFUlWKb9mBubT9uhTYq2CgW9+6dgjouSgMuI74FlCtlkK3ecuWaLrq8nlaFRExvg8 7h1w== X-Received: by 10.70.4.226 with SMTP id n2mr1618744pdn.11.1424290563731; Wed, 18 Feb 2015 12:16:03 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <24fc6e1c-1db3-41e0-84df-18b0ca5a8c69@googlegroups.com> References: <24fc6e1c-1db3-41e0-84df-18b0ca5a8c69@googlegroups.com> From: Ian Kelly Date: Wed, 18 Feb 2015 13:15:23 -0700 Subject: Re: Logging with Custom Levels not working To: Python Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 12 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1424290567 news.xs4all.nl 2832 [2001:888:2000:d::a6]:50188 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 3479 X-Received-Body-CRC: 1109114108 Xref: csiph.com comp.lang.python:85818 On Wed, Feb 18, 2015 at 6:49 AM, Didymus wrote: > def perror(self, message, *args, **kws): > """ Performance Error Message Level """ > # Yes, logger takes its '*args' as 'args'. > self._log(PERROR_NUM, message, args, **kws) > > logging.Logger.perror = perror I think you need to call self.log, not self._log. The _log method appears to assume that the level check has already been performed. You really shouldn't be calling it directly anyway, as the leading _ is an indication that the method is not part of the public API.