elogger API
Overview Classes Cluster Class Index          Top Features

root_cluster.logging

Class ELOG_LOGGER


Direct ancestors

ELOG_SEVERITY_CONSTANTS, COMPARABLE

Creation

Features

Invariants

indexing

description

A Logger. Has to be created by ELOG_HIERARCHY.

class ELOG_LOGGER

inherit

ELOG_SEVERITY_CONSTANTS
COMPARABLE
PART_COMPARABLE

create

make (a_hierarchy: ELOG_HIERARCHY; logger_name: STRING)

-- Create new logger with 'logger_name'
-- Defaults are:
-- no appenders attached
-- is_additive = True

require

logger_name_exists: logger_name /= Void and then logger_name.count > 0

ensure

hierarchy_set: hierarchy = a_hierarchy
name_set: name = logger_name
additive: is_additive
appenders_valid: appenders /= Void and then appenders.count = 0
internal_severity_void: internal_severity = Void

feature {ELOG_HIERARCHY} -- Initialisation

make (a_hierarchy: ELOG_HIERARCHY; logger_name: STRING)

-- Create new logger with 'logger_name'
-- Defaults are:
-- no appenders attached
-- is_additive = True

require

logger_name_exists: logger_name /= Void and then logger_name.count > 0

ensure

hierarchy_set: hierarchy = a_hierarchy
name_set: name = logger_name
additive: is_additive
appenders_valid: appenders /= Void and then appenders.count = 0
internal_severity_void: internal_severity = Void

feature -- Access

get_severity_from_string (a_string: STRING): ELOG_SEVERITY

-- returns a severity from the given string (if valid)
-- (From ELOG_SEVERITY_CONSTANTS)

feature -- Comparison

infix "<" (other: like Current): BOOLEAN

-- Is current object less than other?
-- (From PART_COMPARABLE)

require

other_exists: other /= Void

ensure then

asymmetric: Result implies not (other < Current)

infix "<=" (other: like Current): BOOLEAN

-- Is current object less than or equal to other?
-- (From PART_COMPARABLE)

require

other_exists: other /= Void

ensure then

definition: Result = ((Current < other) or is_equal (other))

infix ">" (other: like Current): BOOLEAN

-- Is current object greater than other?
-- (From PART_COMPARABLE)

require

other_exists: other /= Void

ensure then

definition: Result = (other < Current)

infix ">=" (other: like Current): BOOLEAN

-- Is current object greater than or equal to other?
-- (From PART_COMPARABLE)

require

other_exists: other /= Void

ensure then

definition: Result = (other <= Current)

is_equal (other: like Current): BOOLEAN

-- Is other attached to an object of the same type
-- as current object and identical to it?
-- (From ANY)

require

other_not_void: other /= Void

ensure

symmetric: Result implies other.is_equal (Current)
consistent: standard_is_equal (other) implies Result

max (other: like Current): like Current

-- The greater of current object and other
-- (From COMPARABLE)

require

other_exists: other /= Void

ensure

current_if_not_smaller: Current >= other implies Result = Current
other_if_smaller: Current < other implies Result = other

min (other: like Current): like Current

-- The smaller of current object and other
-- (From COMPARABLE)

require

other_exists: other /= Void

ensure

current_if_not_greater: Current <= other implies Result = Current
other_if_greater: Current > other implies Result = other

three_way_comparison (other: like Current): INTEGER

-- If current object equal to other, 0;
-- if smaller, -1; if greater, 1
-- (From COMPARABLE)

require

other_exists: other /= Void

ensure

equal_zero: (Result = 0) = is_equal (other)
smaller_negative: (Result = -1) = (Current < other)
greater_positive: (Result = 1) = (Current > other)

feature -- Constants

Critical_int: INTEGER_8

Critical_severity: ELOG_SEVERITY

-- Critical must be used to indicate that
-- an immediate action is needed and the
-- scope is broad (perhaps an imminent
-- outage to a critical resource will
-- result).
-- (From ELOG_SEVERITY_CONSTANTS)

Critical_string: STRING

Disabled_int: INTEGER_8

Disabled_severity: ELOG_SEVERITY

-- Do not use this severity for log messages.
-- only use it to disable loggers.
-- (From ELOG_SEVERITY_CONSTANTS)

Disabled_string: STRING

Fatal_int: INTEGER_8

Fatal_severity: ELOG_SEVERITY

-- Fatal must be used to indicate that an
-- error occurred, but it is too late
-- to take remedial action
-- (From ELOG_SEVERITY_CONSTANTS)

Fatal_string: STRING

Harmless_int: INTEGER_8

Harmless_severity: ELOG_SEVERITY

-- Harmless must be used for cases in which
-- the error event has no effect on the normal
-- operation of the resource.
-- (From ELOG_SEVERITY_CONSTANTS)

Harmless_string: STRING

Information_int: INTEGER_8

Information_severity: ELOG_SEVERITY

-- Information must be used for cases when the
-- event contains only general information and
-- is not reporting an error.
-- (From ELOG_SEVERITY_CONSTANTS)

Information_string: STRING

Max_severity_int: INTEGER_8

Minor_int: INTEGER_8

Minor_severity: ELOG_SEVERITY

-- Minor must be used to indicate that
-- action is needed, but the situation
-- is not serious at this time.
-- (From ELOG_SEVERITY_CONSTANTS)

Minor_string: STRING

Unknown_int: INTEGER_8

Unknown_severity: ELOG_SEVERITY

-- Use this severity only if you are unsure
-- about the events severity. This is the
-- lowest possible severity.
-- (From ELOG_SEVERITY_CONSTANTS)

Unknown_string: STRING

Warning_int: INTEGER_8

Warning_severity: ELOG_SEVERITY

-- Warning must be used when it is appropriate
-- to let the user decide if an action is
-- needed in response to the event.
-- (From ELOG_SEVERITY_CONSTANTS)

Warning_string: STRING

feature {ELOG_LOGGER} -- Internal

inform_that_parents_severity_changed (s: ELOG_SEVERITY)

-- informs logger, that its parents severity has
-- changed.

require

s_not_void: s /= Void

inherited_appenders: DS_LINKED_LIST[ELOG_APPENDER]

-- recurse through ancestors to receive all
-- appenders (including own appenders)

ensure

result_not_void: Result /= Void

inherited_severity: ELOG_SEVERITY

-- recurse through ancestors to receive first
-- non-void severity

ensure

result_not_void: Result /= Void

recursive_add_appender (an_appender: ELOG_APPENDER)

-- a ancestor (or current) has added the appender 'an_appender'
-- if is_additive is enabled, add the appender

require

an_appender_not_void: an_appender /= Void

ensure

appender_added: is_additive implies appenders.has (an_appender)

recursive_remove_appender (appender_name: STRING)

-- have all the children recompute their appenders
-- not very performant, but remove won't be called that
-- often.

require

appender_not_void: appender_name /= Void

feature {ELOG_LOGGER, ELOG_HIERARCHY} -- Internal

children: DS_LINKED_LIST[ELOG_LOGGER]

-- List of child loggers.

set_parent (new_parent: ELOG_LOGGER)

-- Set the parent for this logger.

require

not_root: hierarchy.root /= Current
new_parent_exists: new_parent /= Void

feature -- Logging

log (event_severity: ELOG_SEVERITY; message: ELOG_EVENT)

-- Log a general message.

require

event_severity_exists: event_severity /= Void
message_exists: message /= Void

log_critical (message: ELOG_EVENT)

-- Logs the message at critical severity, if enabled for that level.

require

message_exists: message /= Void

log_fatal (message: ELOG_EVENT)

-- Logs the message at fatal severity, if enabled for that level.

require

message_exists: message /= Void

log_harmless (message: ELOG_EVENT)

-- Logs the message at harmless severity, if enabled for that level.

require

message_exists: message /= Void

log_information (message: ELOG_EVENT)

-- Logs the message at information severity, if enabled for that level.

require

message_exists: message /= Void

log_minor (message: ELOG_EVENT)

-- Logs the message at minor severity, if enabled for that level.

require

message_exists: message /= Void

log_unknown (message: ELOG_EVENT)

-- Logs the message at unknown severity, if enabled for that level.

require

message_exists: message /= Void

log_warning (message: ELOG_EVENT)

-- Logs the message at warning severity, if enabled for that level.

require

message_exists: message /= Void

feature -- Status Report

count_appenders: INTEGER

-- returns the number of appenders contained.

get_appender_by_name (an_appender: STRING): ELOG_APPENDER

-- returns the given appender

require

an_appender_not_void: an_appender /= Void
has_appender: has_appender_by_name (an_appender)

ensure

Result_not_void: Result /= Void

has_appender (an_appender: ELOG_APPENDER): BOOLEAN

-- does this logger have the appender?

require

an_appender_not_void: an_appender /= Void

has_appender_by_name (an_appender: STRING): BOOLEAN

-- does this logger have the appender?

require

an_appender_not_void: an_appender /= Void

hierarchy: ELOG_HIERARCHY

-- The hierarchy in which this logger operates.

is_additive: BOOLEAN

-- Should appenders of this logger's parent be used?

is_enabled_for (check_severity: ELOG_SEVERITY): BOOLEAN

-- Is this logger enabled for 'check_severity'?

require

check_severity_exists: check_severity /= Void

is_severity_set: BOOLEAN

-- Does this logger have a severity set? False if the severity
-- will be inherited from an ancestor.

name: STRING

-- Name of this logger

parent: ELOG_LOGGER

-- The parent of this logger.

severity: ELOG_SEVERITY

-- The severity is updated every time a change
-- is made to the logger tree

feature -- Status Setting

add_appender (new_appender: ELOG_APPENDER)

-- Add 'new_appender' to the list of
-- appenders for this logger.

require

new_appender_exists: new_appender /= Void

ensure

appender_added: appenders.has (new_appender) and internal_appenders.has (new_appender)

close_appenders

-- Close all appenders (this level only).
-- NOTE: you will have to reopen the appenders, if
-- you want to log anything. Closing the appenders
-- will also close all files and close any open
-- streams.

import_settings (a_logger: ELOG_LOGGER)

-- merges the current logger with 'a_logger'.
-- overwrites settings from 'a_logger' to Current
-- (appenders, is_additive and severity)

require

a_logger_not_void: a_logger /= Void

remove_appender (appender_name: STRING)

-- Remove appender with name 'appender_name'
-- Iterates to find matching appender.

require

name_exists: appender_name /= Void

set_additive (flag: BOOLEAN)

-- Set additive status to 'flag'.

ensure

flag_set: flag = is_additive

set_severity (new_severity: ELOG_SEVERITY)

-- Set the priority for this logger. Pass Void to unset the
-- priority and use an ancestor's.

require

root_severity_not_void: hierarchy.root = Current implies new_severity /= Void

wipe_out_appenders

-- remove all appenders from the list.

feature {ELOG_DISPATCHER, ELOG_LOGGER} -- Implementation

appender_mutex: ELOG_MUTEX

-- mutex for 'appenders'

appenders: DS_LINKED_LIST[ELOG_APPENDER]

-- Appenders for this logger.

invariant

name_exists: name /= Void and then not name.is_empty
appenders_exist: appenders /= Void
childrean_exist: children /= Void
current_in_parents_children: parent /= Void implies parent.children.has (Current)
childrens_parent_equal_current: invariant_children_test

-- From ANY
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)

-- From COMPARABLE
irreflexive_comparison: not (Current < Current)

Documentation generated by edoc