|
Last change
on this file was
136,
checked in by rosiere, 16 years ago
|
|
1) Add new algo in ifetch queue
2) Add Cancel bit
3) new config
|
-
Property svn:keywords set to
Id
|
|
File size:
2.0 KB
|
| Line | |
|---|
| 1 | /* |
|---|
| 2 | * $Id: Message.cpp 136 2009-10-20 18:52:15Z rosiere $ |
|---|
| 3 | * |
|---|
| 4 | * [ Description ] |
|---|
| 5 | * |
|---|
| 6 | */ |
|---|
| 7 | |
|---|
| 8 | #include <sys/types.h> |
|---|
| 9 | #include "Common/include/Environment.h" |
|---|
| 10 | #include "Common/include/ErrorMorpheo.h" |
|---|
| 11 | #include "Common/include/Filename.h" |
|---|
| 12 | #include "Common/include/Debug.h" |
|---|
| 13 | |
|---|
| 14 | namespace morpheo { |
|---|
| 15 | |
|---|
| 16 | static bool log_initialized; |
|---|
| 17 | FILE * log_stream; |
|---|
| 18 | bool log_file_generate; |
|---|
| 19 | |
|---|
| 20 | #undef FUNCTION |
|---|
| 21 | #define FUNCTION "log" |
|---|
| 22 | FILE * log (FILE * stream) |
|---|
| 23 | { |
|---|
| 24 | // if log stream is initialized, take this, else return the default stream. |
|---|
| 25 | return (log_initialized and (log_stream!=NULL))?log_stream:stream; |
|---|
| 26 | }; |
|---|
| 27 | |
|---|
| 28 | #undef FUNCTION |
|---|
| 29 | #define FUNCTION "log_init" |
|---|
| 30 | void log_init (bool have_file, |
|---|
| 31 | bool with_date, |
|---|
| 32 | bool with_pid , |
|---|
| 33 | std::string directory, |
|---|
| 34 | std::string file) |
|---|
| 35 | { |
|---|
| 36 | if (not log_initialized) |
|---|
| 37 | { |
|---|
| 38 | log_initialized = true; |
|---|
| 39 | log_file_generate = have_file; |
|---|
| 40 | |
|---|
| 41 | #if 0 |
|---|
| 42 | if (have_file) |
|---|
| 43 | { |
|---|
| 44 | // if the file is not define, take pid. |
|---|
| 45 | std::string filename = morpheo::filename(directory, |
|---|
| 46 | "Morpheo", |
|---|
| 47 | "", |
|---|
| 48 | "log", |
|---|
| 49 | with_date, |
|---|
| 50 | with_pid, |
|---|
| 51 | true); |
|---|
| 52 | |
|---|
| 53 | log_stream = fopen (filename.c_str(), "w"); |
|---|
| 54 | |
|---|
| 55 | if (log_stream==NULL) |
|---|
| 56 | { |
|---|
| 57 | fprintf(stderr,_("%s Error create log file \"%s\", take the standard output.\n"),MSG_ERROR,filename.c_str()); |
|---|
| 58 | log_stream = stdout; |
|---|
| 59 | } |
|---|
| 60 | else |
|---|
| 61 | { |
|---|
| 62 | fprintf(stdout,_("%s Create log file \"%s\".\n"),MSG_INFORMATION,filename.c_str()); |
|---|
| 63 | } |
|---|
| 64 | } |
|---|
| 65 | else |
|---|
| 66 | #endif |
|---|
| 67 | { |
|---|
| 68 | log_stream = NULL; |
|---|
| 69 | } |
|---|
| 70 | } |
|---|
| 71 | } |
|---|
| 72 | |
|---|
| 73 | }; // end namespace morpheo |
|---|
Note: See
TracBrowser
for help on using the repository browser.