~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/logging.cc

  • Committer: Brian Aker
  • Date: 2010-03-03 06:10:48 UTC
  • mfrom: (1309.2.21 build)
  • Revision ID: brian@gaz-20100303061048-8td60qna3byx0bgo
MErge.

Show diffs side-by-side

added added

removed removed

Lines of Context:
96
96
  }
97
97
};
98
98
 
 
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
};
99
122
 
100
123
/* This is the Logging::preDo entry point.
101
124
   This gets called by the rest of the Drizzle server code */
127
150
  return iter != all_loggers.end();
128
151
}
129
152
 
 
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
 
130
167
} /* namespace drizzled */