[libcamera-devel,3/3] libcamera: Use the logger instead of cout

Message ID 20181204221123.571-4-laurent.pinchart@ideasonboard.com
State Accepted
Commit cc7d204b2c51853f7d963d144f5944e209e7ea29
Headers show
Series
  • libcamera: Add initial logger support
Related show

Commit Message

Laurent Pinchart Dec. 4, 2018, 10:11 p.m. UTC
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 include/libcamera/libcamera.h |  4 ++++
 src/libcamera/main.cpp        | 10 ++++++----
 test/init.cpp                 |  2 +-
 3 files changed, 11 insertions(+), 5 deletions(-)

Comments

Kieran Bingham Dec. 6, 2018, 2:25 p.m. UTC | #1
Hi Laurent,

A bit of an empty commit message - but I don't think that matters too
much at the moment ...

This changes namespaceing which might have been nicer to split out
explicitly ... but I'm not going to object...

On 04/12/2018 22:11, Laurent Pinchart wrote:
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> ---
>  include/libcamera/libcamera.h |  4 ++++
>  src/libcamera/main.cpp        | 10 ++++++----
>  test/init.cpp                 |  2 +-
>  3 files changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/include/libcamera/libcamera.h b/include/libcamera/libcamera.h
> index 64857326a0b0..790771b61e41 100644
> --- a/include/libcamera/libcamera.h
> +++ b/include/libcamera/libcamera.h
> @@ -7,10 +7,14 @@
>  #ifndef __LIBCAMERA_LIBCAMERA_H__
>  #define __LIBCAMERA_LIBCAMERA_H__
>  
> +namespace libcamera {
> +
>  class libcamera
>  {
>  public:
>  	void init_lib(void);
>  };
>  
> +};
> +
>  #endif /* __LIBCAMERA_LIBCAMERA_H__ */
> diff --git a/src/libcamera/main.cpp b/src/libcamera/main.cpp
> index 0059e0c91571..7ed37dfcfd5b 100644
> --- a/src/libcamera/main.cpp
> +++ b/src/libcamera/main.cpp
> @@ -5,13 +5,15 @@
>   * main.cpp - libcamera main class
>   */
>  
> -#include <iostream>
>  #include <libcamera/libcamera.h>
>  
> -using std::cout;
> -using std::endl;
> +#include "log.h"
> +
> +namespace libcamera {
>  
>  void libcamera::init_lib(void)
>  {
> -	cout << "Lib Camera Init" << endl;
> +	LOG(Info) << "Lib Camera Init";
>  }
> +
> +};
> diff --git a/test/init.cpp b/test/init.cpp
> index 8c8ec9adfb83..278169cdbf1e 100644
> --- a/test/init.cpp
> +++ b/test/init.cpp
> @@ -2,7 +2,7 @@
>  
>  int main(void)
>  {
> -	libcamera l = libcamera();
> +	libcamera::libcamera l = libcamera::libcamera();
>  	l.init_lib();
>  
>  	return 0;
>

Patch

diff --git a/include/libcamera/libcamera.h b/include/libcamera/libcamera.h
index 64857326a0b0..790771b61e41 100644
--- a/include/libcamera/libcamera.h
+++ b/include/libcamera/libcamera.h
@@ -7,10 +7,14 @@ 
 #ifndef __LIBCAMERA_LIBCAMERA_H__
 #define __LIBCAMERA_LIBCAMERA_H__
 
+namespace libcamera {
+
 class libcamera
 {
 public:
 	void init_lib(void);
 };
 
+};
+
 #endif /* __LIBCAMERA_LIBCAMERA_H__ */
diff --git a/src/libcamera/main.cpp b/src/libcamera/main.cpp
index 0059e0c91571..7ed37dfcfd5b 100644
--- a/src/libcamera/main.cpp
+++ b/src/libcamera/main.cpp
@@ -5,13 +5,15 @@ 
  * main.cpp - libcamera main class
  */
 
-#include <iostream>
 #include <libcamera/libcamera.h>
 
-using std::cout;
-using std::endl;
+#include "log.h"
+
+namespace libcamera {
 
 void libcamera::init_lib(void)
 {
-	cout << "Lib Camera Init" << endl;
+	LOG(Info) << "Lib Camera Init";
 }
+
+};
diff --git a/test/init.cpp b/test/init.cpp
index 8c8ec9adfb83..278169cdbf1e 100644
--- a/test/init.cpp
+++ b/test/init.cpp
@@ -2,7 +2,7 @@ 
 
 int main(void)
 {
-	libcamera l = libcamera();
+	libcamera::libcamera l = libcamera::libcamera();
 	l.init_lib();
 
 	return 0;