From patchwork Sun Feb 17 03:24:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1043560 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="CM41JUE6"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 442CG54C7Wz9s3x for ; Sun, 17 Feb 2019 14:31:25 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 1E3DDC21E63; Sun, 17 Feb 2019 03:27:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id E92F6C21E57; Sun, 17 Feb 2019 03:26:12 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E228AC21E44; Sun, 17 Feb 2019 03:25:53 +0000 (UTC) Received: from mail-it1-f197.google.com (mail-it1-f197.google.com [209.85.166.197]) by lists.denx.de (Postfix) with ESMTPS id BCC22C21F05 for ; Sun, 17 Feb 2019 03:25:46 +0000 (UTC) Received: by mail-it1-f197.google.com with SMTP id p205so24012528itc.4 for ; Sat, 16 Feb 2019 19:25:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=fCm5Mzs54MnsXLu7/hbRwIoNwQZ5zFjyD/asv63ms0I=; b=CM41JUE6GANn1u502qkjJmxiL5D11ObjNQl2ppxdWa8+kXFcOvafnJyzItNERLLEwN zk71ED1mIzHTSzlmkGvP1c5IywsQgkw/eyv1rWNv0BuKpt8bySYAQmSytpZjS7fmL/xc m7zfwN7GW1s+5faOurqPl2lcQYgv6P5gmOlDQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=fCm5Mzs54MnsXLu7/hbRwIoNwQZ5zFjyD/asv63ms0I=; b=ZjiVAgYPoDAl27aL0yCUTnXl+IqUx5c0lCgTNR2awawTR4t1nKdDztqjJOags4dASo iiDT1U0knH90iPjV3c/zGWyYFB6Gji1AHQ8BL5i2ZthdxfxX2DYmgafKvSq7z4Q5nG2f 7s3fKG81ooplyty/9rgBBaPrZAEGZ+knv0NJnmYK+YCHIhMBnhK29KJUGgf0IR8J6RqM mIWaoeLIlrXY3dNJLR0D6FsU8/LXyFjNOTTkHLgEqDdx9enkewwApuKjpUp6V76SquOF YWTQdLsI2kOQMM/tpiHg7QdIAc524qv8Wo9fe5dDp9dV6O/wBKQ5tg8AFTQ1EK+ByvRA Ac+w== X-Gm-Message-State: AHQUAuZCR0kA6+yQrWYltn8aMtXxNQ8hI7yTAO5vFAgBVhaNcTkDVnKD Iw6d5LqlQoqWEcyAcx0urncV/G3ZZJvPQDlu X-Google-Smtp-Source: AHgI3IYwHlnQVi/MyWQb23onO74hCqdGcNtURKsSd8Bqp/RVL5g0YTo1KdVkwgrmb9JGdrlA+dbdOFS8xZwank6V X-Received: by 2002:a05:660c:702:: with SMTP id l2mr10294706itk.38.1550373945793; Sat, 16 Feb 2019 19:25:45 -0800 (PST) Date: Sat, 16 Feb 2019 20:24:36 -0700 In-Reply-To: <20190217032507.124320-1-sjg@chromium.org> Message-Id: <20190217032507.124320-4-sjg@chromium.org> Mime-Version: 1.0 References: <20190217032507.124320-1-sjg@chromium.org> X-Mailer: git-send-email 2.21.0.rc0.258.g878e2cd30e-goog From: Simon Glass To: U-Boot Mailing List Subject: [U-Boot] [PATCH v2 03/34] log: Add documentation for convenience functions X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The log_debug(), etc. function are documented only in the header file at present. Add a section to README.log also. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- Changes in v2: - Also remove this feature from the TODO doc/README.log | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/doc/README.log b/doc/README.log index 2ee1b753bc7..75350ecd41d 100644 --- a/doc/README.log +++ b/doc/README.log @@ -69,6 +69,32 @@ If CONFIG_LOG is not set, then no logging will be available. The above have SPL versions also, e.g. CONFIG_SPL_MAX_LOG_LEVEL. +Convenience functions +--------------------- + +A number of convenience functions are available to shorten the code needed +for logging: + + log_err(_fmt...) + log_warning(_fmt...) + log_notice(_fmt...) + log_info(_fmt...) + log_debug(_fmt...) + log_content(_fmt...) + log_io(_fmt...) + +With these the log level is implicit in the name. The category is set by +LOG_CATEGORY, which you can only define once per file, above all #includes: + + #define LOG_CATEGORY LOGC_ALLOC + +or + + #define LOG_CATEGORY UCLASS_SPI + +Remember that all uclasses IDs are log categories too. + + Log commands ------------ @@ -187,16 +213,6 @@ Convenience functions to support setting the category: log_core(level, format_string, ...) - category LOGC_CORE log_dt(level, format_string, ...) - category LOGC_DT -Convenience functions to support a category defined for a single file, for -example: - - #define LOG_CATEGORY UCLASS_USB - -all of these can use LOG_CATEGORY as the category, and a log level -corresponding to the function name: - - logc(level, format_string, ...) - More logging destinations: device - goes to a device (e.g. serial)