Last change
on this file was
136,
checked in by rosiere, 15 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
|
Rev | Line | |
---|
[88] | 1 | /* |
---|
| 2 | * $Id: Message.cpp 136 2009-10-20 18:52:15Z rosiere $ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
[115] | 8 | #include <sys/types.h> |
---|
[88] | 9 | #include "Common/include/Environment.h" |
---|
| 10 | #include "Common/include/ErrorMorpheo.h" |
---|
[100] | 11 | #include "Common/include/Filename.h" |
---|
[115] | 12 | #include "Common/include/Debug.h" |
---|
[88] | 13 | |
---|
| 14 | namespace morpheo { |
---|
| 15 | |
---|
[97] | 16 | static bool log_initialized; |
---|
| 17 | FILE * log_stream; |
---|
[134] | 18 | bool log_file_generate; |
---|
[97] | 19 | |
---|
[88] | 20 | #undef FUNCTION |
---|
[97] | 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 |
---|
[88] | 29 | #define FUNCTION "log_init" |
---|
[97] | 30 | void log_init (bool have_file, |
---|
[124] | 31 | bool with_date, |
---|
[120] | 32 | bool with_pid , |
---|
[97] | 33 | std::string directory, |
---|
| 34 | std::string file) |
---|
| 35 | { |
---|
| 36 | if (not log_initialized) |
---|
| 37 | { |
---|
[134] | 38 | log_initialized = true; |
---|
| 39 | log_file_generate = have_file; |
---|
[120] | 40 | |
---|
[136] | 41 | #if 0 |
---|
[97] | 42 | if (have_file) |
---|
| 43 | { |
---|
| 44 | // if the file is not define, take pid. |
---|
[100] | 45 | std::string filename = morpheo::filename(directory, |
---|
| 46 | "Morpheo", |
---|
| 47 | "", |
---|
| 48 | "log", |
---|
[124] | 49 | with_date, |
---|
[120] | 50 | with_pid, |
---|
[100] | 51 | true); |
---|
[97] | 52 | |
---|
| 53 | log_stream = fopen (filename.c_str(), "w"); |
---|
[134] | 54 | |
---|
[97] | 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 |
---|
[136] | 66 | #endif |
---|
[97] | 67 | { |
---|
| 68 | log_stream = NULL; |
---|
| 69 | } |
---|
| 70 | } |
---|
| 71 | } |
---|
| 72 | |
---|
[88] | 73 | }; // end namespace morpheo |
---|
Note: See
TracBrowser
for help on using the repository browser.