/****************************************************************************/
/* Copyright (c) 2000 MIT Sea Grant                                         */
/* MIT Sea Grant Proprietary Information. All rights reserved.              */
/****************************************************************************/
/* Summary  :                                                               */
/* Filename : LblLog.cc                                                     */
/* Author   : Don Eickstedt                                                 */
/* Project  :                                                               */
/* Version  : 1.0                                                           */
/* Created  : 05/29/2000                                                    */
/* Modified :                                                               */
/* Archived :                                                               */
/****************************************************************************/
/* Modification History:                                                    */
/****************************************************************************/
/****************************************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <string.h>
#include "System.h"
#include "LblLog.h"
#include "Syslog.h"


LblLog::LblLog()
{
char *auvLogDir = getenv(AuvLogDirName);
sprintf(_fileName, "%s/%s/%s.log", auvLogDir, LatestLogDirName,"LBL");
}

LblLog::~LblLog()
{
}

LblLog::write(char *message)
{
FILE *log;
time_t time_of_day;
char buf[26];
char out_mess[120];
struct tm tmbuf;


if ((log = fopen(_fileName,"a+"))==NULL)
  Syslog::write("Failure opening LBL Log");
else
  {
  time_of_day = time(NULL);
  _gmtime(&time_of_day,&tmbuf);
  strftime(out_mess,120,"%D %T ",&tmbuf);
  strcat(out_mess,message);
  fprintf(log,"%s\n",out_mess);
  fclose(log);
  }
}
