]> 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 0804c012c1377012a4f922f27539ef201b8d513b..cbcffd9108414a75a1f217fb7b44092c7b487b98 100644 (file)
@@ -11,11 +11,11 @@ App::Rgit::Utils - Miscellanous utilities for App::Rgit classes.
 
 =head1 VERSION
 
-Version 0.03
+Version 0.04
 
 =cut
 
-our $VERSION = '0.03';
+our $VERSION = '0.04';
 
 =head1 DESCRIPTION
 
@@ -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 ];