From 97c4d9ec1874fa2acbb33d6442d62089be07786b Mon Sep 17 00:00:00 2001 From: David Steele Date: Wed, 26 Jul 2017 10:22:22 -0400 Subject: [PATCH] Reduce log verbosity in doc.pl. Reduce verbosity by only logging sections that contain an execute list directly or in a child section. --- doc/doc.pl | 2 +- doc/lib/BackRestDoc/Common/DocExecute.pm | 2 +- doc/lib/BackRestDoc/Common/DocRender.pm | 12 ++++++++++++ doc/lib/BackRestDoc/Html/DocHtmlPage.pm | 5 ++++- doc/lib/BackRestDoc/Latex/DocLatexSection.pm | 5 ++++- doc/lib/BackRestDoc/Markdown/DocMarkdownRender.pm | 5 ++++- doc/xml/release.xml | 4 ++++ 7 files changed, 30 insertions(+), 5 deletions(-) diff --git a/doc/doc.pl b/doc/doc.pl index 80c08722f..57b83f052 100755 --- a/doc/doc.pl +++ b/doc/doc.pl @@ -270,7 +270,7 @@ eval elsif (($strOutput eq 'help' || $strOutput eq 'man') && $oManifest->isBackRest()) { # Generate the command-line help - my $oRender = new BackRestDoc::Common::DocRender('text', $oManifest); + my $oRender = new BackRestDoc::Common::DocRender('text', $oManifest, !$bNoExe); my $oDocConfig = new BackRestDoc::Common::DocConfig( new BackRestDoc::Common::Doc("${strBasePath}/xml/reference.xml"), $oRender); diff --git a/doc/lib/BackRestDoc/Common/DocExecute.pm b/doc/lib/BackRestDoc/Common/DocExecute.pm index d5cfbadfe..c515ca315 100644 --- a/doc/lib/BackRestDoc/Common/DocExecute.pm +++ b/doc/lib/BackRestDoc/Common/DocExecute.pm @@ -57,7 +57,7 @@ sub new ); # Create the class hash - my $self = $class->SUPER::new($strType, $oManifest, $strRenderOutKey); + my $self = $class->SUPER::new($strType, $oManifest, $bExe, $strRenderOutKey); bless $self, $class; if (defined($self->{oSource}{hyCache})) diff --git a/doc/lib/BackRestDoc/Common/DocRender.pm b/doc/lib/BackRestDoc/Common/DocRender.pm index 74fa97c6f..e8b7c5411 100644 --- a/doc/lib/BackRestDoc/Common/DocRender.pm +++ b/doc/lib/BackRestDoc/Common/DocRender.pm @@ -156,6 +156,7 @@ sub new my $strOperation, $self->{strType}, $self->{oManifest}, + $self->{bExe}, $self->{strRenderOutKey}, ) = logDebugParam @@ -163,6 +164,7 @@ sub new __PACKAGE__ . '->new', \@_, {name => 'strType'}, {name => 'oManifest'}, + {name => 'bExe'}, {name => 'strRenderOutKey', required => false} ); @@ -432,6 +434,10 @@ sub build $oNode->paramSet('depend-default', $strDependPrev); } + # Set log to true if this section has an execute list. This helps reduce the info logging by only showing sections that are + # likely to take a log time. + $oNode->paramSet('log', $self->{bExe} && $oNode->nodeList('execute-list', false) > 0 ? true : false); + # If section content is being pulled from elsewhere go get the content if ($oNode->paramTest('source')) { @@ -527,6 +533,12 @@ sub build if (ref(\$oChild) ne "SCALAR") { $self->build($oChild, $oNode, $strPath, $strPathPrefix); + + # If the child should be logged then log the parent as well so the hierarchy is complete + if ($oChild->nameGet() eq 'section' && $oChild->paramGet('log')) + { + $oNode->paramSet('log', true); + } } } } diff --git a/doc/lib/BackRestDoc/Html/DocHtmlPage.pm b/doc/lib/BackRestDoc/Html/DocHtmlPage.pm index 2d31ce914..193a13c09 100644 --- a/doc/lib/BackRestDoc/Html/DocHtmlPage.pm +++ b/doc/lib/BackRestDoc/Html/DocHtmlPage.pm @@ -219,7 +219,10 @@ sub sectionProcess {name => 'iDepth'} ); - &log(INFO, (' ' x ($iDepth + 1)) . 'process section: ' . $oSection->paramGet('path')); + if ($oSection->paramGet('log')) + { + &log(INFO, (' ' x ($iDepth + 1)) . 'process section: ' . $oSection->paramGet('path')); + } if ($iDepth > 3) { diff --git a/doc/lib/BackRestDoc/Latex/DocLatexSection.pm b/doc/lib/BackRestDoc/Latex/DocLatexSection.pm index c7cb0e6a1..3b7fa8927 100644 --- a/doc/lib/BackRestDoc/Latex/DocLatexSection.pm +++ b/doc/lib/BackRestDoc/Latex/DocLatexSection.pm @@ -110,7 +110,10 @@ sub sectionProcess {name => 'iDepth'} ); - &log(INFO, (' ' x ($iDepth + 1)) . 'process section: ' . $oSection->paramGet('path')); + if ($oSection->paramGet('log')) + { + &log(INFO, (' ' x ($iDepth + 1)) . 'process section: ' . $oSection->paramGet('path')); + } # Create the section my $strSectionTitle = $self->processText($oSection->nodeGet('title')->textGet()); diff --git a/doc/lib/BackRestDoc/Markdown/DocMarkdownRender.pm b/doc/lib/BackRestDoc/Markdown/DocMarkdownRender.pm index cd4832a4b..f17044f1c 100644 --- a/doc/lib/BackRestDoc/Markdown/DocMarkdownRender.pm +++ b/doc/lib/BackRestDoc/Markdown/DocMarkdownRender.pm @@ -176,7 +176,10 @@ sub sectionProcess {name => 'iDepth'} ); - &log(INFO, (' ' x ($iDepth + 1)) . 'process section: ' . $oSection->paramGet('path')); + if ($oSection->paramGet('log')) + { + &log(INFO, (' ' x ($iDepth + 1)) . 'process section: ' . $oSection->paramGet('path')); + } if ($iDepth > 3) { diff --git a/doc/xml/release.xml b/doc/xml/release.xml index fb68a8bd8..6ce0b3067 100644 --- a/doc/xml/release.xml +++ b/doc/xml/release.xml @@ -206,6 +206,10 @@ + +

Reduce log verbosity when building documentation by only logging sections that contain an execute list directly or in a child section.

+
+

Debian/Ubuntu documentation now builds on Ubuntu 16.