function initialize_log, name_string ;+ ;$Log: ; ; NAME: ; initialize_log ; ; PURPOSE: ; Creates a log file and writes a message to indicate the start of the log file ; ; CATEGORY: ; AMIE Calibration - part of the project 'amie_pipeline' ; ; CALLING SEQUENCE: ; logname = initialize_log (name_string) ; ; INPUTS: ; name_string: string message created by the program to be inserted in the log file ; the current date is then appended to the name ; ; OUTPUTS: ; log file name for use in the create log entries module ; log file of the AMIE pipeline ; ; COMMON BLOCKS: ; None. ; ; SIDE EFFECTS: ; Hopefully none. ; ; RESTRICTIONS: ; The log file must be started with the start keyword at the beginning of the program. ; ; MODIFICATION HISTORY: ; 2004 Feb 16, MA: First version ; ; (c) 2004, Miguel Almeida, ESA/RSSD ;- ;------------------------------------------------------------------------------------------------------------------------- ; ;Create log file on disk with time of creation in the file name ; ;------------------------------------------------------------------------------------------------------------------------- ;------------------------------------------------------------------------------------------------------------------------- ;retrieve the date and time from the system in UTC and put it in the format YYYYMonDD_HHhMMmSSs date_time = string(FORMAT='(C(CYI,CMoA,CDI2.2,"_",CHI2.2, "h", CMI2.2,"m", CSI2.2,"s"))',SYSTIME(/julian,/utc)) ;------------------------------------------------------------------------------------------------------------------------- ;------------------------------------------------------------------------------------------------------------------------- ;create the log file name with the name string that is input to the initialize log procedure and the string of ;the log file creation date and time filename_string = name_string + date_time + '.log' ;------------------------------------------------------------------------------------------------------------------------- openw, log_unit, filename_string, /get_lun ;------------------------------------------------------------------------------------------------------------------------- ;put two entries in the log file flagging the pipeline initialization and the creation of the log file printf, log_unit, '['+date_time+' UT] ' + '[INITIALIZE LOG] AMIE Pipeline initialized ' printf, log_unit, '['+date_time+' UT] [INITIALIZE LOG] ' + filename_string + ' created' ;------------------------------------------------------------------------------------------------------------------------- close, log_unit free_lun, log_unit ;------------------------------------------------------------------------------------------------------------------------- ; ;Returns the log name to the main program in order to be possible for the rest of the modules to create entries ; ;------------------------------------------------------------------------------------------------------------------------- logname = filename_string return, logname end