The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Log::ProgramInfo - log global info from a perl programs.

### HISTORY ################################################################### # Version Date Developer Comments # 0.1.1 2015-04-02 John Macdonald Initial release to CPAN # 0.1.2 2015-04-04 John Macdonald Minor cleanups to initial release # 0.1.3 2015-04-09 John Macdonald Rename s/JobInof/ProgramInfo/ #

VERSION

Version 0.1.3

SYNOPSIS

                use Log::ProgramInfo qw(
                        [ -logname LOGNAME                 ]
                        [ -logdir  LOGDIR                  ]
                        [ -logext  LOGEXT                  ]
                        [ -logdate none|date|time|datetime ]
                        [ -stdout                          ]
                        [ -suppress                        ]
                        );

                # main program does lots of stuff...
                exit 0;

        After the program has run, this module will automatically
        log information about this run into a log file.  It will
        list such things as:
          - program
            - name
                - version
          - command line arguments
          - version of perl
          - modules loaded
            - source code location
            - Version
          - run time

        The log is appended to the file:
            LOGDIR/LOGDATE-LOGNAME.LOGEXT
        where
            LOGDIR        defaults to . (the current directory when the program terminates)
            LOGDATE       defaults to the date that the program was started
            LOGNAME       defaults to the basename of the program
                LOGEXT        defaults to ".jobinfolog"

        The -ARG specifiers in the "import" list can be used to over-ride these defaults.  Specifying:

        -logname LOGNAME  will use LOGNAME instead of the program name
        -logdir  LOGDIR   will use LOGDIR instead of the current directory
                            - if it is a relative path, it will be based on the
                              current directory at termination of execution
        -logext  EXT      will add .EXT to the log filename
        -logext  .EXT     will add .EXT to the log filename
        -logext  ""       will add no extension to the log filename
        -logdate STRING
                          will specify the LOGDATE portion of the filename.  The STRING can be:
                              none      LOGNAME (and no dash)
                              date      YYYYMMDD-LOGNAME   (this is the default)
                              time      HHMMSS-LOGNAME
                              datetime  YYYYMMDDHHMMSS-LOGNAME

        -stdout           will cause the log to be sent to stdout instead of a file
        -suppress         will suppress logging (unless environment variable
                              LOGJOBINFO_SUPPRESS is explcitly set to 0 or null)

                              Normally, neither -suppress nor -stdout will be set in the
                              use statement, and the environment variables can then be
                              used to disable the logging completely or to send it to
                              stdout instead of to the selected file.

                              For some programs, however, it may be desired to not normally
                              provide any logging.  Specifying -suppress will accomplish
                              this.  In such a case, setting the environment variable
                              LOGJOBINFO_SUPPRESS=0 will over-ride that choice, causing
                              the log to be written (as specified by the other options
                              and environment variables).

        Environment variables can over-ride some of these:
            LOGJOBINFO_SUPPRESS=x  boolean suppresses all logging if true
            LOGJOBINFO_STDOUT=x    boolean sets -stdout
            LOGJOBINFO_DIR=DIR     string  sets the target directory name
            LOGJOBINFO_FILE=FILE   string  sets the target filename LOGNAME
            LOGJOBINFO_EXT=EXT     string  sets the target extension
            LOGJOBINFO_DATE=DATE   string  sets the target filename LOGDATE selector