CernVM-FS  2.10.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
logging.cc File Reference
#include "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 "platform.h"
#include "smalloc.h"
#include "util/mutex.h"
#include "util/posix.h"
#include "util/single_copy.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 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))
 
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

const unsigned anonymous_namespace{logging.cc}::kMicroSyslogMax = 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 528 of file logging.cc.

Here is the call graph for this function:

std::vector<LogBufferEntry> GetLogBuffer ( )

Definition at line 524 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 303 of file logging.cc.

Referenced by PosixQuotaManager::CreateShared(), Watchdog::ReportStacktrace(), and Watchdog::Supervise().

Here is the caller graph for this function:

int GetLogSyslogFacility ( )

Definition at line 213 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 167 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 574 of file logging.cc.

Referenced by LogCvmfs().

Here is the call graph for this function:

Here is the caller graph for this function:

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

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 417 of file logging.cc.

Here is the call graph for this function:

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

Definition at line 311 of file logging.cc.

Referenced by LogCvmfs().

Here is the call graph for this function:

Here is the caller graph for this function:

void LogShutdown ( )

Definition at line 595 of file logging.cc.

Here is the call graph for this function:

void PrintWarning ( const string &  message)

Definition at line 536 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 403 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 544 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 267 of file logging.cc.

Referenced by FuseMain(), LogShutdown(), PosixQuotaManager::MainCacheManager(), loader::loader_talk::MainTalk(), Watchdog::ReportStacktrace(), FileSystem::SetupLogging(), Watchdog::Supervise(), FileSystem::TearDown2ReadOnly(), and FileSystem::~FileSystem().

Here is the call graph for this function:

Here is the caller graph for this function:

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 182 of file logging.cc.

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

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 150 of file logging.cc.

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

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 240 of file logging.cc.

Referenced by FuseMain(), FileSystem::SetupLogging(), and FileSystem::~FileSystem().

Here is the caller graph for this function:

void SetLogSyslogShowPID ( bool  flag)

Definition at line 253 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 260 of file logging.cc.

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

Here is the caller graph for this function: