RocketLogger 2.1.1
log.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define RL_LOG_DEFAULT_FILE   "/var/log/rocketlogger.log"
 Default log file name.
 
#define RL_LOG_PATH_LENGTH_MAX   256
 Maximum log file name path length.
 
#define RL_LOG_FILE_SIZE_MAX   (1000 * 1000)
 Maximum log file size in bytes.
 

Typedefs

typedef enum rl_log_level rl_log_level_t
 

Enumerations

enum  rl_log_level {
  RL_LOG_IGNORE , RL_LOG_ERROR , RL_LOG_WARNING , RL_LOG_INFO ,
  RL_LOG_VERBOSE
}
 

Functions

int rl_log_init (char const *const log_file, rl_log_level_t verbosity)
 
void rl_log_verbosity (rl_log_level_t verbosity)
 
int rl_log (rl_log_level_t log_level, char const *const format,...)
 

Macro Definition Documentation

◆ RL_LOG_DEFAULT_FILE

#define RL_LOG_DEFAULT_FILE   "/var/log/rocketlogger.log"

Default log file name.

Copyright (c) 2016-2020, ETH Zurich, Computer Engineering Group All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition at line 36 of file log.h.

◆ RL_LOG_FILE_SIZE_MAX

#define RL_LOG_FILE_SIZE_MAX   (1000 * 1000)

Maximum log file size in bytes.

Definition at line 42 of file log.h.

◆ RL_LOG_PATH_LENGTH_MAX

#define RL_LOG_PATH_LENGTH_MAX   256

Maximum log file name path length.

Definition at line 39 of file log.h.

Typedef Documentation

◆ rl_log_level_t

Typedef for RocketLogger level types

Definition at line 58 of file log.h.

Enumeration Type Documentation

◆ rl_log_level

RocketLogger log level definition

Enumerator
RL_LOG_IGNORE 

Ignore log (only for verbosity configuration)

RL_LOG_ERROR 

Error.

RL_LOG_WARNING 

Warning.

RL_LOG_INFO 

Information.

RL_LOG_VERBOSE 

Verbose.

Definition at line 47 of file log.h.

Function Documentation

◆ rl_log()

◆ rl_log_init()

int rl_log_init ( char const *const  log_file,
rl_log_level_t  verbosity 
)

Initialize the log module.

Note
This function should be called before the first log message is stored.
Parameters
log_fileThe filename of the file the log messages are written to
verbosityMessages with a log level more severe or equal to this level are also printed to the terminal
Returns
Returns 0 on success, negative on failure with errno set accordingly

Definition at line 49 of file log.c.

References RL_LOG_FILE_SIZE_MAX, and rl_log_verbosity().

Referenced by main(), and main().

+ Here is the call graph for this function:

◆ rl_log_verbosity()

void rl_log_verbosity ( rl_log_level_t  verbosity)

Change the log module's verbosity.

Parameters
verbosityMessages with log levels more severe or equal to the verbosity level are also printed to the terminal

Definition at line 80 of file log.c.

Referenced by rl_log_init().