ct_logs

Logging functionality for Common Test Framework.

Logging functionality for Common Test Framework.

This module implements

  • Internal logging of activities in Common Test Framework

  • Compilation of test results into index pages on several levels

Functions


add_external_logs(Logs) -> ok

  • Logs = [Log]
  • Log = string()

Print a link to each given Log in the test case log.

The given Logs must exist in the priv dir of the calling test suite.

add_link(Heading, File, Type) -> ok

  • Heading = string()
  • File = string()
  • Type = string()

Print a link to a given file stored in the priv_dir of the calling test suite.

clear_stylesheet(TC) -> ok

close(How) -> ok

Create index pages with test results and close the CT Log (tool-internal use only).

cont_log(Format, Args) -> ok

Adds information about an activity (tool-internal use only).

See also: end_log/0, start_log/1.

end_log() -> ok

Ends the logging of an activity (tool-internal use only).

See also: cont_log/2, start_log/1.

end_tc(TCPid) -> ok | {error, Reason}

Test case clean up (tool-internal use only).

This function is called by ct_framework:end_tc/3

get_log_dir() -> {ok, Dir} | {error, Reason}

init(Mode) -> Result

  • Mode = normal | interactive
  • Result = {StartTime, LogDir}
  • StartTime = term()
  • LogDir = string()

Initiate the logging mechanism (tool-internal use only).

This function is called by ct_util.erl when testing is started. A new directory named ct_run.<timestamp> is created and all logs are stored under this directory.

init_tc() -> ok

Test case initiation (tool-internal use only).

This function is called by ct_framework:init_tc/3

log(Heading, Format, Args) -> ok

Log internal activity (tool-internal use only).

This function writes an entry to the currently active log, i.e. either the CT log or a test case log.

Heading is a short string indicating what type of activity it is. Format and Args is the data to log (as in io:format(Format,Args)).

make_all_runs_index(When) -> term()

make_all_suites_index(When) -> term()

make_last_run_index() -> term()

set_stylesheet(TC, SSFile) -> ok

simulate() -> pid()

Simulate the logger process.

Simulate the logger process - for use when testing code using ct_logs logging mechanism without using the ct environment. (E.g. when testing code with ts)

start_log(Heading) -> ok

Starts the logging of an activity (tool-internal use only).

This function must be used in combination with cont_log/2 and end_log/0. The intention is to call start_log once, then cont_log any number of times and finally end_log once.

For information about the parameters, see log/3.

See also: cont_log/2, end_log/0, log/3.

tc_log(Category, Format, Args) -> ok

  • Category = atom()
  • Format = string()
  • Args = list()

Printout from a testcase.

This function is called by ct when logging stuff directly from a testcase (i.e. not from within the CT framework).

tc_pal(Category, Format, Args) -> ok

  • Category = atom()
  • Format = string()
  • Args = list()

Print and log from a testcase.

This function is called by ct when logging stuff directly from a testcase. The info is written both in the log and on the console.

tc_print(Category, Format, Args) -> ok

  • Category = atom()
  • Format = string()
  • Args = list()

Console printout from a testcase.

This function is called by ct when printing stuff a testcase on the user console.

View Functions