403Webshell
Server IP : 104.21.38.3  /  Your IP : 104.23.175.196
Web Server : Apache
System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64
User : www ( 1000)
PHP Version : 7.4.33
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /www/server/mysql/src/sql/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/server/mysql/src/sql/ndb_log.cc
/*
   Copyright (c) 2014, 2023, Oracle and/or its affiliates.

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License, version 2.0,
   as published by the Free Software Foundation.

   This program is also distributed with certain software (including
   but not limited to OpenSSL) that is licensed under separate terms,
   as designated in a particular file or component or in included license
   documentation.  The authors of MySQL hereby grant you an additional
   permission to link the program and your derivative works with the
   separately licensed software that they have included with MySQL.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License, version 2.0, for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
*/

#include "ndb_log.h"

// Use log.h until there is a plugin API which provides printing to error log
// without polluting the message with it's own hardcoded string and without
// need to pass in a MYSQL_PLUGIN pointer. Presumably 'my_plugin_log_service'
// can be extended with a my_log_message(level, prefix, message, ...) function
#include "log.h"


/*
  Print message to MySQL Server's error log(s)

  @param loglevel    Selects the loglevel used when
                     printing the message to log.
  @param prefix      Prefix to be used in front of the message in
                     addition to "NDB" i.e "NDB <prefix>:"
  @param[in]  fmt    printf-like format string
  @param[in]  ap     Arguments

*/

void
ndb_log_print(enum ndb_log_loglevel loglevel,
              const char* prefix, const char* fmt, va_list args)
{
  assert(fmt);

  // Assemble the message
  char msg_buf[512];
  (void)my_vsnprintf(msg_buf, sizeof(msg_buf), fmt, args);

  // Print message to MySQL error log
  switch (loglevel)
  {
    case NDB_LOG_ERROR_LEVEL:
      if (prefix)
        sql_print_error("NDB %s: %s", prefix, msg_buf);
      else
        sql_print_error("NDB: %s", msg_buf);
      break;
    case NDB_LOG_WARNING_LEVEL:
      if (prefix)
        sql_print_warning("NDB %s: %s", prefix, msg_buf);
      else
        sql_print_warning("NDB: %s", msg_buf);
      break;
    case NDB_LOG_INFORMATION_LEVEL:
      if (prefix)
        sql_print_information("NDB %s: %s", prefix, msg_buf);
      else
        sql_print_information("NDB: %s", msg_buf);
      break;
  }
}


void
ndb_log_info(const char* fmt, ...)
{
  assert(fmt);

  va_list args;
  va_start(args, fmt);
  ndb_log_print(NDB_LOG_INFORMATION_LEVEL, NULL, fmt, args);
  va_end(args);
}


void
ndb_log_warning(const char* fmt, ...)
{
  assert(fmt);

  va_list args;
  va_start(args, fmt);
  ndb_log_print(NDB_LOG_WARNING_LEVEL, NULL, fmt, args);
  va_end(args);
}


void
ndb_log_error(const char* fmt, ...)
{
  assert(fmt);

  va_list args;
  va_start(args, fmt);
  ndb_log_print(NDB_LOG_ERROR_LEVEL, NULL, fmt, args);
  va_end(args);
}


// the verbose level is currently controlled by "ndb_extra_logging"
extern ulong opt_ndb_extra_logging;

unsigned
ndb_log_get_verbose_level(void)
{
  return opt_ndb_extra_logging;
}


void
ndb_log_verbose(unsigned verbose_level, const char* fmt, ...)
{
  assert(fmt);

  // Print message only if verbose level is set high enough
  if (ndb_log_get_verbose_level() < verbose_level)
    return;

  va_list args;
  va_start(args, fmt);
  ndb_log_print(NDB_LOG_INFORMATION_LEVEL, NULL, fmt, args);
  va_end(args);
}


Youez - 2016 - github.com/yon3zu
LinuXploit