Module riaknostic_check

Enforces a common API among all diagnostic modules and provides some automation around their execution.

This module defines the riaknostic_check behaviour.
Required callback functions: description/0, valid/0, check/0, format/1.

Description

Enforces a common API among all diagnostic modules and provides some automation around their execution.

Behaviour Specification

description/0

-spec description() -> iodata().

A short description of what the diagnostic does, which will be printed when the script is given the -l flag.

valid/0

-spec valid() -> boolean().

Whether the diagnostic is valid to run. For example, some checks require connectivity to the Riak node and hence call riaknostic_node:can_connect().

check/0

-spec check() -> [{lager:log_level(), term()}].

Runs the diagnostic, returning a list of pairs, where the first is a severity level and the second is any term that is understood by the format/1 callback.

format/1

-spec format(term()) -> iodata() | {io:format(), [term()]}.

Formats terms that were returned from check/0 for output to the console. Valid return values are an iolist (string, binary, etc) or a pair of a format string and a list of terms, as you would pass to io:format/2.

Function Index

behaviour_info/1The behaviour definition for diagnostic modules.
check/1Runs the diagnostic in the given module, if it is valid.
modules/0Collects a list of diagnostic modules included in the riaknostic application.
print/1Formats and prints the given message via lager:log/3,4.

Function Details

behaviour_info/1

behaviour_info(X1::atom()) -> undefined | [{atom(), arity()}]

The behaviour definition for diagnostic modules.

check/1

check(Module::module()) -> [{lager:log_level(), module(), term()}]

Runs the diagnostic in the given module, if it is valid. Returns a list of messages that will be printed later using print/1.

modules/0

modules() -> [module()]

Collects a list of diagnostic modules included in the riaknostic application.

print/1

print(X1::{Level::lager:log_level(), Module::module(), Data::term()}) -> ok

Formats and prints the given message via lager:log/3,4. The diagnostic module's format/1 function will be called to provide a human-readable message. It should return an iolist() or a 2-tuple consisting of a format string and a list of terms.


Generated by EDoc, Feb 18 2012, 03:37:56.