#include <locked_logger.h>
Inheritance diagram for locked_logger:


Public Member Functions | |
| locked_logger (log_base *the_logger=NIL) | |
| if the stored logger is NIL, then all operations will be ignored. | |
| virtual | ~locked_logger () |
| IMPLEMENT_CLASS_NAME ("locked_logger") | |
| bool | established () |
| returns true if the log_base has been established with a real pointer. | |
| virtual void | add_filter (int new_filter) |
| Adds a member to the filter set. | |
| virtual void | remove_filter (int old_filter) |
| Removes a member from the filter set. | |
| virtual bool | member (int filter_to_check) |
| Returns true if the "filter_to_check" is a member of the filter set. | |
| virtual void | clear_filters () |
| Resets the filter set to be empty. | |
| virtual int_set | filter_set () |
| Returns the current filter set's contents. | |
| virtual line_ending | eol () |
| observes how line endings are to be printed. | |
| virtual void | eol (line_ending to_set) |
| modifies how line endings are to be printed. | |
| virtual istring | get_ending () |
| returns a string for the current ending. | |
| virtual void | get_ending (istring &to_end) |
| appends a string for the current ending to "to_end". | |
| virtual outcome | log (const istring &info, int filter=ALWAYS_PRINT) |
| writes the information in "info" to the log using the "filter" value. | |
Used in program-wide logging support to safely replace the logging mechanism. These logging objects will all be derived from log_base. A program can start out with a null logging mechanism and plug in logging to file or to a server as needed.
Definition at line 31 of file locked_logger.h.
| locked_logger::locked_logger | ( | log_base * | the_logger = NIL |
) |
if the stored logger is NIL, then all operations will be ignored.
Definition at line 25 of file locked_logger.cpp.
References portable::application_name(), and portable::process_id().
| locked_logger::~locked_logger | ( | ) | [virtual] |
Definition at line 36 of file locked_logger.cpp.
References NIL, locked_object< log_base >::swap(), and WHACK().
| locked_logger::IMPLEMENT_CLASS_NAME | ( | "locked_logger" | ) |
| bool locked_logger::established | ( | ) |
returns true if the log_base has been established with a real pointer.
returns false if the internal log_base is still NIL.
Definition at line 52 of file locked_logger.cpp.
References LOCK_LOGGER, and UNLOCK_LOGGER.
| void locked_logger::add_filter | ( | int | new_filter | ) | [virtual] |
Adds a member to the filter set.
The filter set is used to check all extended filter values passed to log and print. if the special filters of ALWAYS_PRINT or NEVER_PRINT are added, then either everything will be logged or nothing will be.
Reimplemented from log_base.
Definition at line 59 of file locked_logger.cpp.
References LOCK_LOGGER, and UNLOCK_LOGGER.
| void locked_logger::remove_filter | ( | int | old_filter | ) | [virtual] |
Removes a member from the filter set.
Reimplemented from log_base.
Definition at line 66 of file locked_logger.cpp.
References LOCK_LOGGER, and UNLOCK_LOGGER.
| bool locked_logger::member | ( | int | filter_to_check | ) | [virtual] |
Returns true if the "filter_to_check" is a member of the filter set.
If "filter_to_check" is ALWAYS_PRINT, this always returns true. If the value is NEVER_PRINT, false is always returned.
Reimplemented from log_base.
Definition at line 73 of file locked_logger.cpp.
References LOCK_LOGGER, and UNLOCK_LOGGER.
| void locked_logger::clear_filters | ( | ) | [virtual] |
Resets the filter set to be empty.
Reimplemented from log_base.
Definition at line 81 of file locked_logger.cpp.
References LOCK_LOGGER, and UNLOCK_LOGGER.
| int_set locked_logger::filter_set | ( | ) | [virtual] |
Returns the current filter set's contents.
Reimplemented from log_base.
Definition at line 88 of file locked_logger.cpp.
References LOCK_LOGGER, and UNLOCK_LOGGER.
| log_base::line_ending locked_logger::eol | ( | ) | [virtual] |
observes how line endings are to be printed.
Reimplemented from log_base.
Definition at line 96 of file locked_logger.cpp.
References log_base::LF_AT_END, LOCK_LOGGER, and UNLOCK_LOGGER.
| void locked_logger::eol | ( | line_ending | to_set | ) | [virtual] |
modifies how line endings are to be printed.
Reimplemented from log_base.
Definition at line 104 of file locked_logger.cpp.
References LOCK_LOGGER, and UNLOCK_LOGGER.
| istring locked_logger::get_ending | ( | ) | [virtual] |
returns a string for the current ending.
Reimplemented from log_base.
Definition at line 111 of file locked_logger.cpp.
References istring::empty_string(), LOCK_LOGGER, and UNLOCK_LOGGER.
| void locked_logger::get_ending | ( | istring & | to_end | ) | [virtual] |
appends a string for the current ending to "to_end".
Reimplemented from log_base.
Definition at line 119 of file locked_logger.cpp.
References LOCK_LOGGER, and UNLOCK_LOGGER.
writes the information in "info" to the log using the "filter" value.
the "filter" value must be checked to see if it is in the current set of allowed filters (using member()). this function _must_ be provided by derived classes and it _must_ check the filter before printing if it wants to be in compliance with log_base protocols. it also must implement the line_ending appropriately. the return value will often be a member of the common outcomes, but derived classes may see fit to return other things. note that an object derived from log_base should be thread-safe and protect its own member attributes through synchronization.
Implements log_base.
Definition at line 126 of file locked_logger.cpp.
References common::BAD_INPUT, LOCK_LOGGER, and UNLOCK_LOGGER.
1.5.1