PILog ready to use
This commit is contained in:
@@ -48,12 +48,27 @@ public:
|
||||
Debug,
|
||||
};
|
||||
|
||||
enum Output {
|
||||
File = 0x1,
|
||||
Console = 0x2,
|
||||
All = 0xFF,
|
||||
};
|
||||
|
||||
//! \~english Set output target \"o\" to \"on\".
|
||||
void setOutput(Output o, bool on = true) { output.setFlag(o, on); }
|
||||
|
||||
//! \~english Returns prefix for filename.
|
||||
PIString logName() const { return log_name; }
|
||||
|
||||
//! \~english Set prefix for filename. Should be set \b before \a setDir()!
|
||||
void setLogName(const PIString & n) { log_name = n; }
|
||||
|
||||
//! \~english Returns if color for console output enabled.
|
||||
bool colorConsole() const { return color_console; }
|
||||
|
||||
//! \~english Set color for console output enabled. True by default.
|
||||
void setColorConsole(bool yes) { color_console = yes; }
|
||||
|
||||
|
||||
//! \~english Returns directory for log files.
|
||||
PIString dir() const { return log_dir; }
|
||||
@@ -89,10 +104,16 @@ public:
|
||||
//! \~english Set maximum level. All levels greater than \"l\" will be ignored. Default if \a Level::Debug.
|
||||
void setLevel(Level l);
|
||||
|
||||
|
||||
//! \~english Returns PICout for Level::Error level.
|
||||
PICout error(PIObject * context = nullptr);
|
||||
|
||||
//! \~english Returns PICout for Level::Warning level.
|
||||
PICout warning(PIObject * context = nullptr);
|
||||
|
||||
//! \~english Returns PICout for Level::Info level.
|
||||
PICout info(PIObject * context = nullptr);
|
||||
|
||||
//! \~english Returns PICout for Level::Debug level.
|
||||
PICout debug(PIObject * context = nullptr);
|
||||
|
||||
//! \~english Write all queued lines and stop. Also called in destructor.
|
||||
@@ -122,7 +143,9 @@ private:
|
||||
PIString log_dir, timestamp_format, line_format, line_format_p, log_name;
|
||||
PIQueue<Entry> queue;
|
||||
PIMap<Level, int> id_by_cat;
|
||||
Level max_level = Level::Debug;
|
||||
Level max_level = Level::Debug;
|
||||
PIFlags<Output> output = All;
|
||||
bool color_console = true;
|
||||
int part_number = -1, cout_id = -1;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user