source: trunk/IPs/systemC/processor/Morpheo/Common/src/Message.cpp @ 88

Last change on this file since 88 was 88, checked in by rosiere, 15 years ago

Almost complete design
with Test and test platform

  • Property svn:keywords set to Id
File size: 989 bytes
Line 
1#ifdef LOG_FILE
2/*
3 * $Id: Message.cpp 88 2008-12-10 18:31:39Z rosiere $
4 *
5 * [ Description ]
6 *
7 */
8
9#include "Common/include/Debug.h"
10#include "Common/include/Environment.h"
11#include "Common/include/ToString.h"
12#include "Common/include/ErrorMorpheo.h"
13#include <sys/types.h>
14#include <unistd.h>
15
16namespace morpheo {
17
18static bool log_initialized;
19FILE * log_stream;
20
21#undef  FUNCTION
22#define FUNCTION "log_init"
23void log_init (void)
24{
25  if (not log_initialized)
26    {
27      log_initialized = true;
28
29      directory();
30     
31      std::string filename = MORPHEO_LOG+"/Morpheo_"+toString<pid_t>(getpid())+".log";
32
33      log_stream = fopen (filename.c_str(), "w");
34
35      if (log_stream==NULL)
36        {
37          fprintf(stderr,_("%s Error create log file \"%s\", take the standard output.\n"),MSG_ERROR,filename.c_str());
38          log_stream = stdout;
39        }
40      else
41        {
42          fprintf(stdout,_("%s Create log file \"%s\".\n"),MSG_INFORMATION,filename.c_str());
43        }
44    }
45}
46
47}; // end namespace morpheo
48#endif
Note: See TracBrowser for help on using the repository browser.