]> git.vpit.fr Git - perl/modules/rgit.git/blobdiff - lib/App/Rgit/Utils.pm
Add a diagnostics mode. Only print infos when this mode is enabled
[perl/modules/rgit.git] / lib / App / Rgit / Utils.pm
index 606df56f722c8dbac9f1693a4aa6f16ae9717e18..cbcffd9108414a75a1f217fb7b44092c7b487b98 100644 (file)
@@ -38,6 +38,19 @@ use constant {
  LAST => 0x8,
 };
 
+=head2 C<DIAG>, C<INFO>, C<WARN>, C<ERR> and C<CRIT>
+
+Message levels.
+
+=cut
+
+use constant {
+ INFO => 3,
+ WARN => 2,
+ ERR  => 1,
+ CRIT => 0,
+};
+
 =head1 FUNCTIONS
 
 =head2 C<validate @method_args>
@@ -60,14 +73,17 @@ C<validate> is only exported on request, either by its name or by the C<'funcs'>
 
 C<NEXT> C<REDO>, C<LAST> and C<SAVE> are only exported on request, either by their name or by the C<'codes'> tags.
 
+C<INFO>, C<WARN>, C<ERR> and C<CRIT> are only exported on request, either by their name or by the C<'levels'> tags.
+
 =cut
 
 use base qw/Exporter/;
 
 our @EXPORT         = ();
 our %EXPORT_TAGS    = (
- funcs => [ qw/validate/ ],
- codes => [ qw/SAVE NEXT REDO LAST/ ],
+ funcs  => [ qw/validate/ ],
+ codes  => [ qw/SAVE NEXT REDO LAST/ ],
+ levels => [ qw/INFO WARN ERR CRIT/ ],
 );
 our @EXPORT_OK      = map { @$_ } values %EXPORT_TAGS;
 $EXPORT_TAGS{'all'} = [ @EXPORT_OK ];