[libcamera-devel] libcamera: ipa_module: Add log prefix

Message ID 20200429002835.29597-1-laurent.pinchart@ideasonboard.com
State Accepted
Commit bcf986d07b1faf5412304cf63a0dfd05dbd91472
Headers show
Series
  • [libcamera-devel] libcamera: ipa_module: Add log prefix
Related show

Commit Message

Laurent Pinchart April 29, 2020, 12:28 a.m. UTC
Make the IPAModule class inherit from Loggable to log the IPA module
name in all messages.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/libcamera/include/ipa_module.h | 6 +++++-
 src/libcamera/ipa_module.cpp       | 5 +++++
 2 files changed, 10 insertions(+), 1 deletion(-)

Comments

Niklas Söderlund April 30, 2020, 12:51 a.m. UTC | #1
Hi Laurent,

Thanks for your work.

On 2020-04-29 03:28:35 +0300, Laurent Pinchart wrote:
> Make the IPAModule class inherit from Loggable to log the IPA module
> name in all messages.

It would be nice with a pre and post example of how the new log-line 
looks in the commit message.

> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

With or without updated commit message,

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

> ---
>  src/libcamera/include/ipa_module.h | 6 +++++-
>  src/libcamera/ipa_module.cpp       | 5 +++++
>  2 files changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/src/libcamera/include/ipa_module.h b/src/libcamera/include/ipa_module.h
> index a9a3511701d4..15022e19edce 100644
> --- a/src/libcamera/include/ipa_module.h
> +++ b/src/libcamera/include/ipa_module.h
> @@ -14,11 +14,12 @@
>  #include <ipa/ipa_interface.h>
>  #include <ipa/ipa_module_info.h>
>  
> +#include "log.h"
>  #include "pipeline_handler.h"
>  
>  namespace libcamera {
>  
> -class IPAModule
> +class IPAModule : public Loggable
>  {
>  public:
>  	explicit IPAModule(const std::string &libPath);
> @@ -37,6 +38,9 @@ public:
>  	bool match(PipelineHandler *pipe,
>  		   uint32_t minVersion, uint32_t maxVersion) const;
>  
> +protected:
> +	std::string logPrefix() const override;
> +
>  private:
>  	struct IPAModuleInfo info_;
>  	std::vector<uint8_t> signature_;
> diff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp
> index 52823e88a508..3444a788b855 100644
> --- a/src/libcamera/ipa_module.cpp
> +++ b/src/libcamera/ipa_module.cpp
> @@ -471,4 +471,9 @@ bool IPAModule::match(PipelineHandler *pipe,
>  	       !strcmp(info_.pipelineName, pipe->name());
>  }
>  
> +std::string IPAModule::logPrefix() const
> +{
> +	return utils::basename(libPath_.c_str());
> +}
> +
>  } /* namespace libcamera */
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

Patch

diff --git a/src/libcamera/include/ipa_module.h b/src/libcamera/include/ipa_module.h
index a9a3511701d4..15022e19edce 100644
--- a/src/libcamera/include/ipa_module.h
+++ b/src/libcamera/include/ipa_module.h
@@ -14,11 +14,12 @@ 
 #include <ipa/ipa_interface.h>
 #include <ipa/ipa_module_info.h>
 
+#include "log.h"
 #include "pipeline_handler.h"
 
 namespace libcamera {
 
-class IPAModule
+class IPAModule : public Loggable
 {
 public:
 	explicit IPAModule(const std::string &libPath);
@@ -37,6 +38,9 @@  public:
 	bool match(PipelineHandler *pipe,
 		   uint32_t minVersion, uint32_t maxVersion) const;
 
+protected:
+	std::string logPrefix() const override;
+
 private:
 	struct IPAModuleInfo info_;
 	std::vector<uint8_t> signature_;
diff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp
index 52823e88a508..3444a788b855 100644
--- a/src/libcamera/ipa_module.cpp
+++ b/src/libcamera/ipa_module.cpp
@@ -471,4 +471,9 @@  bool IPAModule::match(PipelineHandler *pipe,
 	       !strcmp(info_.pipelineName, pipe->name());
 }
 
+std::string IPAModule::logPrefix() const
+{
+	return utils::basename(libPath_.c_str());
+}
+
 } /* namespace libcamera */