theforeman / puppet-pulpcore

Puppet module for setting up Pulp 3 as part of Katello installation
GNU General Public License v3.0
2 stars 28 forks source link

Add a loggers parameter and set default loggers #265

Closed ekohl closed 1 year ago

ekohl commented 1 year ago

This introduces the ability to specify arbitrary loggers with their own log level. While there is currently only a single option, this prepares for future extension.

Additionally, there are default loggers added for pulpcore.deprecation and django_guid. Their levels can still be overridden using the loggers parameter.

ehelms commented 1 year ago

This works for me to combine the best of both worlds, locally I had to apply the following to get tests passing:

diff --git a/manifests/config.pp b/manifests/config.pp
index e79d239..b499d92 100644
--- a/manifests/config.pp
+++ b/manifests/config.pp
@@ -31,11 +31,12 @@ class pulpcore::config {
       'level' => 'WARNING',
     },
   } + $pulpcore::loggers
+
   concat::fragment { 'logging':
     target  => 'pulpcore settings',
     content => epp('pulpcore/settings-logging.py.epp', {
-      'level'   => $pulpcore::log_level,
-      'loggers' => $loggers,
+        'level'   => $pulpcore::log_level,
+        'loggers' => $loggers,
     }),
     order   => '02',
   }
diff --git a/manifests/init.pp b/manifests/init.pp
index f493176..e918772 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -169,7 +169,10 @@
 #   The number of seconds that content should be cached for. Specify 'None' to never expire the cache.
 #
 # @param log_level
-#   Sets the log level.
+#   Sets the log level for the root logger.
+#
+# @param loggers
+#   Configure additional loggers or override pre-defined logger configuration.
 #
 # @example Default configuration
 #   include pulpcore

Would you mind applying that and then we'll take this set of commits in?

ekohl commented 1 year ago

Fixed the lint failures. Thanks!

ehelms commented 1 year ago

Thanks!