~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/logging.cc

Merge Stewart's dead code removal

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include "config.h"
 
20
#include <drizzled/server_includes.h>
21
21
#include <drizzled/plugin/logging.h>
22
22
#include <drizzled/gettext.h>
23
23
#include "drizzled/plugin/registry.h"
24
24
 
25
25
#include <vector>
26
26
 
27
 
class Session;
28
 
 
29
27
using namespace std;
30
28
 
31
29
namespace drizzled
96
94
  }
97
95
};
98
96
 
99
 
class PostEndIterate : public unary_function<plugin::Logging *, bool>
100
 
{
101
 
  Session *session;
102
 
public:
103
 
  PostEndIterate(Session *session_arg) :
104
 
    unary_function<plugin::Logging *, bool>(),
105
 
    session(session_arg) {}
106
 
 
107
 
  /* This gets called once for each loaded logging plugin */
108
 
  inline result_type operator()(argument_type handler)
109
 
  {
110
 
    if (handler->postEnd(session))
111
 
    {
112
 
      /* TRANSLATORS: The leading word "logging" is the name
113
 
         of the plugin api, and so should not be translated. */
114
 
      errmsg_printf(ERRMSG_LVL_ERROR,
115
 
                    _("logging '%s' postEnd() failed"),
116
 
                    handler->getName().c_str());
117
 
      return true;
118
 
    }
119
 
    return false;
120
 
  }
121
 
};
122
97
 
123
98
/* This is the Logging::preDo entry point.
124
99
   This gets called by the rest of the Drizzle server code */
150
125
  return iter != all_loggers.end();
151
126
}
152
127
 
153
 
/* This gets called in the session destructor */
154
 
bool plugin::Logging::postEndDo(Session *session)
155
 
{
156
 
  /* Use find_if instead of foreach so that we can collect return codes */
157
 
  vector<plugin::Logging *>::iterator iter=
158
 
    find_if(all_loggers.begin(), all_loggers.end(),
159
 
            PostEndIterate(session));
160
 
  /* If iter is == end() here, that means that all of the plugins returned
161
 
   * false, which in this case means they all succeeded. Since we want to
162
 
   * return false on success, we return the value of the two being !=
163
 
   */
164
 
  return iter != all_loggers.end();
165
 
}
166
 
 
167
128
} /* namespace drizzled */