s3_logger Module

Logging module for S3 accessor library.

Provides configurable logging with multiple severity levels to help diagnose issues and understand library behavior.

Log Levels

  • NONE (0): No logging output
  • ERROR (1): Critical errors only
  • WARN (2): Warnings and errors
  • INFO (3): General information, warnings, and errors
  • DEBUG (4): Detailed debugging information
  • TRACE (5): Very detailed tracing (includes curl commands, responses)

Usage

use s3_logger

! Set log level (default is ERROR)
call s3_set_log_level(S3_LOG_LEVEL_DEBUG)

! Log messages at different levels
call s3_log_error('Failed to download object')
call s3_log_warn('Retrying connection')
call s3_log_info('Initialized S3 connection')
call s3_log_debug('Built URL: https://...')
call s3_log_trace('curl command: curl -s ...')

Environment Variable

Log level can be set via environment variable S3_LOG_LEVEL:

export S3_LOG_LEVEL=DEBUG
./my_program

Valid values: NONE, ERROR, WARN, INFO, DEBUG, TRACE (case-insensitive)


Variables

Type Visibility Attributes Name Initial
integer, public, parameter :: S3_LOG_LEVEL_NONE = 0
integer, public, parameter :: S3_LOG_LEVEL_ERROR = 1
integer, public, parameter :: S3_LOG_LEVEL_WARN = 2
integer, public, parameter :: S3_LOG_LEVEL_INFO = 3
integer, public, parameter :: S3_LOG_LEVEL_DEBUG = 4
integer, public, parameter :: S3_LOG_LEVEL_TRACE = 5
integer, private, save :: current_log_level = S3_LOG_LEVEL_ERROR

Functions

public function s3_get_log_level() result(level)

Get the current log level.

Read more…

Arguments

None

Return Value integer


Subroutines

public subroutine s3_init_logger()

Initialize logger from environment variable.

Read more…

Arguments

None

public subroutine s3_set_log_level(level)

Set the current log level.

Read more…

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: level

public subroutine s3_log_error(message)

Log an error message.

Read more…

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: message

public subroutine s3_log_warn(message)

Log a warning message.

Read more…

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: message

public subroutine s3_log_info(message)

Log an informational message.

Read more…

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: message

public subroutine s3_log_debug(message)

Log a debug message.

Read more…

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: message

public subroutine s3_log_trace(message)

Log a trace message (very detailed).

Read more…

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: message

private subroutine parse_log_level(level_str, level)

Parse log level from string.

Read more…

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: level_str
integer, intent(out) :: level