@@ -88,12 +88,16 @@ impl<'a> Changelog<'a> {
8888 match commit. process ( git_config) {
8989 Ok ( commit) => Some ( commit) ,
9090 Err ( e) => {
91- trace ! (
92- "{} - {} ({})" ,
93- commit. id. chars( ) . take( 7 ) . collect:: <String >( ) ,
94- e,
95- commit. message. lines( ) . next( ) . unwrap_or_default( ) . trim( )
96- ) ;
91+ let short_id = commit. id . chars ( ) . take ( 7 ) . collect :: < String > ( ) ;
92+ let summary = commit. message . lines ( ) . next ( ) . unwrap_or_default ( ) . trim ( ) ;
93+ match & e {
94+ Error :: ParseError ( _) | Error :: FieldError ( _) => {
95+ log:: warn!( "{short_id} - {e} ({summary})" ) ;
96+ }
97+ _ => {
98+ log:: trace!( "{short_id} - {e} ({summary})" ) ;
99+ }
100+ }
97101 None
98102 }
99103 }
@@ -102,12 +106,11 @@ impl<'a> Changelog<'a> {
102106 /// Checks the commits and returns an error if any unconventional commits
103107 /// are found.
104108 fn check_conventional_commits ( commits : & Vec < Commit < ' a > > ) -> Result < ( ) > {
105- debug ! ( "Verifying that all commits are conventional. " ) ;
109+ log :: debug!( "Verifying that all commits are conventional" ) ;
106110 let mut unconventional_count = 0 ;
107-
108111 commits. iter ( ) . for_each ( |commit| {
109112 if commit. conv . is_none ( ) {
110- error ! (
113+ log :: error!(
111114 "Commit {id} is not conventional:\n {message}" ,
112115 id = & commit. id[ ..7 ] ,
113116 message = commit
@@ -164,7 +167,7 @@ impl<'a> Changelog<'a> {
164167 /// Processes the commits and omits the ones that doesn't match the
165168 /// criteria set by configuration file.
166169 fn process_commits ( & mut self ) -> Result < ( ) > {
167- debug ! ( "Processing the commits... " ) ;
170+ log :: debug!( "Processing the commits" ) ;
168171 for release in self . releases . iter_mut ( ) {
169172 Self :: process_commit_list ( & mut release. commits , & self . config . git ) ?;
170173 for submodule_commits in release. submodule_commits . values_mut ( ) {
@@ -176,7 +179,7 @@ impl<'a> Changelog<'a> {
176179
177180 /// Processes the releases and filters them out based on the configuration.
178181 fn process_releases ( & mut self ) {
179- debug ! ( "Processing {} release(s)... " , self . releases. len( ) ) ;
182+ log :: debug!( "Processing {} release(s)" , self . releases. len( ) ) ;
180183 let skip_regex = self . config . git . skip_tags . as_ref ( ) ;
181184 let mut skipped_tags = Vec :: new ( ) ;
182185 self . releases = self
@@ -188,13 +191,13 @@ impl<'a> Changelog<'a> {
188191 if let Some ( version) = & release. version {
189192 if skip_regex. is_some_and ( |r| r. is_match ( version) ) {
190193 skipped_tags. push ( version. clone ( ) ) ;
191- trace ! ( "Skipping release: {}" , version) ;
194+ log :: debug !( "Skipping release: {}" , version) ;
192195 return false ;
193196 }
194197 }
195198 if release. commits . is_empty ( ) {
196199 if let Some ( version) = release. version . clone ( ) {
197- trace ! ( "Release doesn't have any commits: {}" , version) ;
200+ log :: debug !( "Release doesn't have any commits: {}" , version) ;
198201 }
199202 match & release. previous {
200203 Some ( prev_release) if prev_release. commits . is_empty ( ) => {
@@ -250,11 +253,8 @@ impl<'a> Changelog<'a> {
250253 . map ( |v| v. contains_variable ( github:: TEMPLATE_VARIABLES ) )
251254 . unwrap_or ( false )
252255 {
253- debug ! (
254- "You are using an experimental feature! Please report bugs at <https://git-cliff.org/issues>"
255- ) ;
256256 let github_client = GitHubClient :: try_from ( self . config . remote . github . clone ( ) ) ?;
257- info ! (
257+ log :: info!(
258258 "{} ({})" ,
259259 github:: START_FETCHING_MSG ,
260260 self . config. remote. github
@@ -267,11 +267,11 @@ impl<'a> Changelog<'a> {
267267 github_client. get_commits( ref_name) ,
268268 github_client. get_pull_requests( ref_name) ,
269269 ) ?;
270- debug ! ( "Number of GitHub commits: {}" , commits. len( ) ) ;
271- debug ! ( "Number of GitHub pull requests: {}" , pull_requests. len( ) ) ;
270+ log :: debug!( "Number of GitHub commits: {}" , commits. len( ) ) ;
271+ log :: debug!( "Number of GitHub pull requests: {}" , pull_requests. len( ) ) ;
272272 Ok ( ( commits, pull_requests) )
273273 } ) ;
274- info ! ( "{}" , github:: FINISHED_FETCHING_MSG ) ;
274+ log :: info!( "{}" , github:: FINISHED_FETCHING_MSG ) ;
275275 data
276276 } else {
277277 Ok ( ( vec ! [ ] , vec ! [ ] ) )
@@ -304,11 +304,8 @@ impl<'a> Changelog<'a> {
304304 . map ( |v| v. contains_variable ( gitlab:: TEMPLATE_VARIABLES ) )
305305 . unwrap_or ( false )
306306 {
307- debug ! (
308- "You are using an experimental feature! Please report bugs at <https://git-cliff.org/issues>"
309- ) ;
310307 let gitlab_client = GitLabClient :: try_from ( self . config . remote . gitlab . clone ( ) ) ?;
311- info ! (
308+ log :: info!(
312309 "{} ({})" ,
313310 gitlab:: START_FETCHING_MSG ,
314311 self . config. remote. gitlab
@@ -321,7 +318,7 @@ impl<'a> Changelog<'a> {
321318 let project_id = match tokio:: join!( gitlab_client. get_project( ref_name) ) {
322319 ( Ok ( project) , ) => project. id ,
323320 ( Err ( err) , ) => {
324- error ! ( "Failed to lookup project! {}" , err) ;
321+ log :: error!( "Failed to lookup project! {}" , err) ;
325322 return Err ( err) ;
326323 }
327324 } ;
@@ -330,11 +327,11 @@ impl<'a> Changelog<'a> {
330327 gitlab_client. get_commits( project_id, ref_name) ,
331328 gitlab_client. get_merge_requests( project_id, ref_name) ,
332329 ) ?;
333- debug ! ( "Number of GitLab commits: {}" , commits. len( ) ) ;
334- debug ! ( "Number of GitLab merge requests: {}" , merge_requests. len( ) ) ;
330+ log :: debug!( "Number of GitLab commits: {}" , commits. len( ) ) ;
331+ log :: debug!( "Number of GitLab merge requests: {}" , merge_requests. len( ) ) ;
335332 Ok ( ( commits, merge_requests) )
336333 } ) ;
337- info ! ( "{}" , gitlab:: FINISHED_FETCHING_MSG ) ;
334+ log :: info!( "{}" , gitlab:: FINISHED_FETCHING_MSG ) ;
338335 data
339336 } else {
340337 Ok ( ( vec ! [ ] , vec ! [ ] ) )
@@ -365,11 +362,8 @@ impl<'a> Changelog<'a> {
365362 . map ( |v| v. contains_variable ( gitea:: TEMPLATE_VARIABLES ) )
366363 . unwrap_or ( false )
367364 {
368- debug ! (
369- "You are using an experimental feature! Please report bugs at <https://git-cliff.org/issues>"
370- ) ;
371365 let gitea_client = GiteaClient :: try_from ( self . config . remote . gitea . clone ( ) ) ?;
372- info ! (
366+ log :: info!(
373367 "{} ({})" ,
374368 gitea:: START_FETCHING_MSG ,
375369 self . config. remote. gitea
@@ -382,11 +376,11 @@ impl<'a> Changelog<'a> {
382376 gitea_client. get_commits( ref_name) ,
383377 gitea_client. get_pull_requests( ref_name) ,
384378 ) ?;
385- debug ! ( "Number of Gitea commits: {}" , commits. len( ) ) ;
386- debug ! ( "Number of Gitea pull requests: {}" , pull_requests. len( ) ) ;
379+ log :: debug!( "Number of Gitea commits: {}" , commits. len( ) ) ;
380+ log :: debug!( "Number of Gitea pull requests: {}" , pull_requests. len( ) ) ;
387381 Ok ( ( commits, pull_requests) )
388382 } ) ;
389- info ! ( "{}" , gitea:: FINISHED_FETCHING_MSG ) ;
383+ log :: info!( "{}" , gitea:: FINISHED_FETCHING_MSG ) ;
390384 data
391385 } else {
392386 Ok ( ( vec ! [ ] , vec ! [ ] ) )
@@ -422,11 +416,8 @@ impl<'a> Changelog<'a> {
422416 . map ( |v| v. contains_variable ( bitbucket:: TEMPLATE_VARIABLES ) )
423417 . unwrap_or ( false )
424418 {
425- debug ! (
426- "You are using an experimental feature! Please report bugs at <https://git-cliff.org/issues>"
427- ) ;
428419 let bitbucket_client = BitbucketClient :: try_from ( self . config . remote . bitbucket . clone ( ) ) ?;
429- info ! (
420+ log :: info!(
430421 "{} ({})" ,
431422 bitbucket:: START_FETCHING_MSG ,
432423 self . config. remote. bitbucket
@@ -439,11 +430,11 @@ impl<'a> Changelog<'a> {
439430 bitbucket_client. get_commits( ref_name) ,
440431 bitbucket_client. get_pull_requests( ref_name)
441432 ) ?;
442- debug ! ( "Number of Bitbucket commits: {}" , commits. len( ) ) ;
443- debug ! ( "Number of Bitbucket pull requests: {}" , pull_requests. len( ) ) ;
433+ log :: debug!( "Number of Bitbucket commits: {}" , commits. len( ) ) ;
434+ log :: debug!( "Number of Bitbucket pull requests: {}" , pull_requests. len( ) ) ;
444435 Ok ( ( commits, pull_requests) )
445436 } ) ;
446- info ! ( "{}" , bitbucket:: FINISHED_FETCHING_MSG ) ;
437+ log :: info!( "{}" , bitbucket:: FINISHED_FETCHING_MSG ) ;
447438 data
448439 } else {
449440 Ok ( ( vec ! [ ] , vec ! [ ] ) )
@@ -462,7 +453,7 @@ impl<'a> Changelog<'a> {
462453 /// Adds remote data (e.g. GitHub commits) to the releases.
463454 #[ allow( unused_variables) ]
464455 pub fn add_remote_data ( & mut self , range : Option < & str > ) -> Result < ( ) > {
465- debug ! ( "Adding remote data... " ) ;
456+ log :: debug!( "Adding remote data" ) ;
466457 self . add_remote_context ( ) ?;
467458
468459 // Determine the ref at which to fetch remote commits, based on the commit
@@ -524,7 +515,7 @@ impl<'a> Changelog<'a> {
524515 if last_release. version . is_none ( ) {
525516 let next_version =
526517 last_release. calculate_next_version_with_config ( & self . config . bump ) ?;
527- debug ! ( "Bumping the version to {next_version}" ) ;
518+ log :: debug!( "Bumping the version to {next_version}" ) ;
528519 last_release. version = Some ( next_version. to_string ( ) ) ;
529520 last_release. timestamp = Some (
530521 SystemTime :: now ( )
@@ -540,7 +531,7 @@ impl<'a> Changelog<'a> {
540531
541532 /// Generates the changelog and writes it to the given output.
542533 pub fn generate < W : Write + ?Sized > ( & self , out : & mut W ) -> Result < ( ) > {
543- debug ! ( "Generating changelog... " ) ;
534+ log :: debug!( "Generating changelog" ) ;
544535 let postprocessors = self . config . changelog . postprocessors . clone ( ) ;
545536
546537 if let Some ( header_template) = & self . header_template {
@@ -603,7 +594,7 @@ impl<'a> Changelog<'a> {
603594
604595 /// Generates a changelog and prepends it to the given changelog.
605596 pub fn prepend < W : Write + ?Sized > ( & self , mut changelog : String , out : & mut W ) -> Result < ( ) > {
606- debug ! ( "Generating changelog and prepending... " ) ;
597+ log :: debug!( "Generating changelog and prepending" ) ;
607598 if let Some ( header) = & self . config . changelog . header {
608599 changelog = changelog. replacen ( header, "" , 1 ) ;
609600 }
@@ -632,7 +623,7 @@ fn get_body_template(config: &Config, trim: bool) -> Result<Template> {
632623 "commit.bitbucket" ,
633624 ] ;
634625 if template. contains_variable ( & deprecated_vars) {
635- warn ! (
626+ log :: warn!(
636627 "Variables {deprecated_vars:?} are deprecated and will be removed in the future. Use \
637628 `commit.remote` instead."
638629 ) ;
0 commit comments