MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
log_client.cc
1 /* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
2 
3  This program is free software; you can redistribute it and/or modify
4  it under the terms of the GNU General Public License as published by
5  the Free Software Foundation; version 2 of the License.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  GNU General Public License for more details.
11 
12  You should have received a copy of the GNU General Public License
13  along with this program; if not, write to the Free Software
14  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
15 
16 #include <my_global.h>
17 #include "common.h"
18 
19 
20 // Client-side logging function
21 
22 void error_log_vprint(error_log_level::type level,
23  const char *fmt, va_list args)
24 {
25  const char *level_string= "";
26  int log_level= get_log_level();
27 
28  switch (level)
29  {
30  case error_log_level::INFO:
31  if (3 > log_level)
32  return;
33  level_string= "Note";
34  break;
35  case error_log_level::WARNING:
36  if (2 > log_level)
37  return;
38  level_string= "Warning";
39  break;
40  case error_log_level::ERROR:
41  if (1 > log_level)
42  return;
43  level_string= "ERROR";
44  break;
45  }
46 
47  fprintf(stderr, "Windows Authentication Plugin %s: ", level_string);
48  vfprintf(stderr, fmt, args);
49  fputc('\n', stderr);
50  fflush(stderr);
51 }
52 
53 
54 // Trivial implementation of log-level setting storage.
55 
56 void set_log_level(unsigned int level)
57 {
58  opt_auth_win_log_level= level;
59 }
60 
61 
62 unsigned int get_log_level(void)
63 {
64  return opt_auth_win_log_level;
65 }