-------------------------------------------------------------------------------
help for usagelog                                             manual:  [R] none
                                                             dialog:   none    
-------------------------------------------------------------------------------

Log usage of Stata programs in an existing text file

usagelog [, message(string) start etime type(string) uerror(string) ]

Description

Usagelog is designed for programmers who want to keep track of how often and, simply, how their program is being used by their users. With usagelog you can log the date and time of day the program was started and completed as well as what the user's command line looked like and any user-error code. This one program can be used to track several programs in different usage log files. When used with the option etime it can report how long the program to took to run in days:hours:mins:secs.

The first line in the usagelog file is:

"Current date", "Current time" and "Work directory"

"Current date" is taken from the creturn variable: `c(current_date)'

"Current time" is taken from the creturn variable: `c(current_time)'

"Work directory" is taken from the creturn variable: `c(pwd)'

Options

start specifies that usagelog is to start logging program.

message can pass any text message to the usagelog file like what options and settings the user of the program submitted.

type specifies the program name or any text string you want the {cmd:usagelog file to start with.

etime specifies to add the elapsed time since start to the usage log file.

uerror provides what error code you want documented at time the program exited. You have to make a call to usagelog before the Stata program really crashes since Stata will likely stop at that time. Uerror is only helpful when you can predict how the program might fail.

Examples

You can make a call to usagelog at the beginning of a program:

usagelog , type(savasas) c(savasas using `using' `if' `in' , type(`type') `replace' `rename')

and then at the end of the program call it again:

usagelog , type(savasas) uerror(5) etime(`s(etime)')

Author

Dan Blanchette The Carolina Population Center University of North Carolina - Chapel Hill, USA dan_blanchette@unc.edu

Also see

On-line: log, etime (if installed) savasas (if installed) usesas (if installed)