CernVM-FS  2.11.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
logging.cc File Reference
#include "util/logging_internal.h"
#include <errno.h>
#include <fcntl.h>
#include <pthread.h>
#include <syslog.h>
#include <time.h>
#include <unistd.h>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <vector>
#include "util/export.h"
#include "util/mutex.h"
#include "util/platform.h"
#include "util/posix.h"
#include "util/single_copy.h"
#include "util/smalloc.h"
Include dependency graph for logging.cc:

Go to the source code of this file.

Classes

class  anonymous_namespace{logging.cc}::LogBuffer
 

Namespaces

 anonymous_namespace{logging.cc}
 

Functions

static void LogCustom (unsigned id, const std::string &message)
 
void SetLogSyslogLevel (const int level)
 
int GetLogSyslogLevel ()
 
void SetLogSyslogFacility (const int local_facility)
 
int GetLogSyslogFacility ()
 
void SetLogSyslogPrefix (const std::string &prefix)
 
void SetLogSyslogShowPID (bool flag)
 
void SetLogVerbosity (const LogLevels max_level)
 
void SetLogMicroSyslogMaxSize (unsigned bytes)
 
void SetLogMicroSyslog (const std::string &filename)
 
std::string GetLogMicroSyslog ()
 
static void LogMicroSyslog (const std::string &message)
 
void SetAltLogFunc (void(*fn)(const LogSource source, const int mask, const char *msg))
 
CVMFS_EXPORT void vLogCvmfs (const LogSource source, const int mask, const char *format, va_list variadic_list)
 
CVMFS_EXPORT void LogCvmfs (const LogSource source, const int mask, const char *format,...)
 
std::vector< LogBufferEntryGetLogBuffer ()
 
void ClearLogBuffer ()
 
void PrintError (const string &message)
 
void PrintWarning (const string &message)
 
void SetLogCustomFile (unsigned id, const std::string &filename)
 
void LogShutdown ()
 

Variables

unsigned anonymous_namespace{logging.cc}::gMicroSyslogMax = 500 * 1024
 
pthread_mutex_t anonymous_namespace{logging.cc}::lock_stdout = PTHREAD_MUTEX_INITIALIZER
 
pthread_mutex_t anonymous_namespace{logging.cc}::lock_stderr = PTHREAD_MUTEX_INITIALIZER
 
const char * anonymous_namespace{logging.cc}::module_names []
 
int anonymous_namespace{logging.cc}::syslog_facility = LOG_USER
 
int anonymous_namespace{logging.cc}::syslog_level = LOG_NOTICE
 
char * anonymous_namespace{logging.cc}::syslog_prefix = NULL
 
string * anonymous_namespace{logging.cc}::usyslog_dest = NULL
 
int anonymous_namespace{logging.cc}::usyslog_fd = -1
 
int anonymous_namespace{logging.cc}::usyslog_fd1 = -1
 
unsigned anonymous_namespace{logging.cc}::usyslog_size = 0
 
pthread_mutex_t anonymous_namespace{logging.cc}::lock_usyslock = PTHREAD_MUTEX_INITIALIZER
 
const unsigned anonymous_namespace{logging.cc}::kMaxCustomlog = 3
 
string * anonymous_namespace{logging.cc}::customlog_dests [] = {NULL, NULL, NULL}
 
int anonymous_namespace{logging.cc}::customlog_fds [] = {-1, -1, -1}
 
pthread_mutex_t anonymous_namespace{logging.cc}::customlog_locks []
 
LogLevels anonymous_namespace{logging.cc}::max_log_level = kLogNormal
 
static void(* anonymous_namespace{logging.cc}::alt_log_func )(const LogSource source, const int mask, const char *msg) = NULL
 
LogBuffer anonymous_namespace{logging.cc}::g_log_buffer
 

Function Documentation

void ClearLogBuffer ( )

Definition at line 539 of file logging.cc.

Here is the call graph for this function:

std::vector<LogBufferEntry> GetLogBuffer ( )

Definition at line 535 of file logging.cc.

Referenced by LogBufferXattr::GetValue().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string GetLogMicroSyslog ( )

Definition at line 308 of file logging.cc.

Referenced by PosixQuotaManager::CreateShared(), and Watchdog::Fork().

Here is the caller graph for this function:

int GetLogSyslogFacility ( )

Definition at line 214 of file logging.cc.

Referenced by PosixQuotaManager::CreateShared(), AuthzExternalFetcher::Handshake(), and SetLogSyslogShowPID().

Here is the caller graph for this function:

int GetLogSyslogLevel ( )

Definition at line 168 of file logging.cc.

Referenced by PosixQuotaManager::CreateShared(), and AuthzExternalFetcher::Handshake().

Here is the caller graph for this function:

static void LogCustom ( unsigned  id,
const std::string &  message 
)
static

Definition at line 585 of file logging.cc.

Referenced by vLogCvmfs().

Here is the call graph for this function:

Here is the caller graph for this function:

CVMFS_EXPORT void LogCvmfs ( const LogSource  source,
const int  mask,
const char *  format,
  ... 
)

Definition at line 528 of file logging.cc.

Here is the call graph for this function:

static void LogMicroSyslog ( const std::string &  message)
static

Definition at line 316 of file logging.cc.

Referenced by vLogCvmfs().

Here is the call graph for this function:

Here is the caller graph for this function:

void LogShutdown ( )

Definition at line 606 of file logging.cc.

Here is the call graph for this function:

void PrintWarning ( const string &  message)

Definition at line 547 of file logging.cc.

Referenced by publish::SyncMediator::Add(), publish::SyncItem::MarkAsWhiteout(), publish::SyncMediator::Remove(), and publish::SyncMediator::Touch().

Here is the caller graph for this function:

void SetAltLogFunc ( void(*)(const LogSource source, const int mask, const char *msg)  fn)

Changes the debug log file from stderr. No effect if DEBUGMSG is undefined.

Definition at line 408 of file logging.cc.

Referenced by cvmfs_set_log_fn(), and download::MainResolveProxyDescription().

Here is the caller graph for this function:

void SetLogCustomFile ( unsigned  id,
const std::string &  filename 
)

Opens a custom log file

Definition at line 555 of file logging.cc.

Referenced by LogShutdown().

Here is the call graph for this function:

Here is the caller graph for this function:

void SetLogMicroSyslog ( const std::string &  filename)

"Micro-Syslog" write kLogSyslog messages into filename. It rotates this file. Requires for µCernVM

Definition at line 272 of file logging.cc.

Referenced by Watchdog::Fork(), FuseMain(), LogShutdown(), main(), PosixQuotaManager::MainCacheManager(), loader::loader_talk::MainTalk(), FileSystem::SetupLoggingStandalone(), FileSystem::TearDown2ReadOnly(), and FileSystem::~FileSystem().

Here is the call graph for this function:

Here is the caller graph for this function:

void SetLogMicroSyslogMaxSize ( unsigned  bytes)

Definition at line 264 of file logging.cc.

void SetLogSyslogFacility ( const int  local_facility)

Sets the syslog facility to one of local0 .. local7. Falls back to LOG_USER if local_facility is not in [0..7]

Definition at line 183 of file logging.cc.

Referenced by FuseMain(), main(), PosixQuotaManager::MainCacheManager(), and FileSystem::SetupLoggingStandalone().

Here is the caller graph for this function:

void SetLogSyslogLevel ( const int  level)

Sets the level that is used for all messages to the syslog facility.

Definition at line 151 of file logging.cc.

Referenced by FuseMain(), main(), PosixQuotaManager::MainCacheManager(), and FileSystem::SetupLoggingStandalone().

Here is the caller graph for this function:

void SetLogSyslogPrefix ( const std::string &  prefix)

The syslog prefix is used to distinguish multiple repositories in /var/log/messages

Definition at line 241 of file logging.cc.

Referenced by FuseMain(), main(), FileSystem::SetupLoggingStandalone(), and FileSystem::~FileSystem().

Here is the caller graph for this function:

void SetLogSyslogShowPID ( bool  flag)

Definition at line 254 of file logging.cc.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

void SetLogVerbosity ( const LogLevels  max_level)

Set the maximum verbosity level. By default kLogNormal.

Definition at line 261 of file logging.cc.

Referenced by swissknife::CommandInfo::Main(), swissknife::CommandPull::Main(), swissknife::CommandCheck::Main(), swissknife::CommandCreate::Main(), and swissknife::CommandSync::Main().

Here is the caller graph for this function:

CVMFS_EXPORT void vLogCvmfs ( const LogSource  source,
const int  mask,
const char *  format,
va_list  variadic_list 
)

Logs a message to one or multiple facilities specified by mask. Mask can be extended by a log level in the future, using the higher bits.

Parameters
[in]sourceComponent that triggers the logging
[in]maskBit mask of log facilities
[in]formatFormat string followed by arguments like printf

Definition at line 423 of file logging.cc.

Referenced by LogCvmfs().

Here is the call graph for this function:

Here is the caller graph for this function: