Module webmachine_log

Helper functions for webmachine's default log handlers.

Description

Helper functions for webmachine's default log handlers

Data Types

add_handler_result()

add_handler_result() = ok | {'EXIT', term()} | term()

datehour()

datehour() = {non_neg_integer(), 1..12, 1..31, 0..23}

delete_handler_result()

delete_handler_result() = term() | {error, module_not_found} | {'EXIT', term()}

error()

error() = {error, bad_module} | {'EXIT', term()} | term()

wm_log_data()

wm_log_data() = #wm_log_data{resource_module = atom(), start_time = tuple(), method = atom(), headers = any(), peer = any(), sock = any(), path = string(), version = any(), response_code = any(), response_length = any(), end_time = undefined | tuple(), finish_time = undefined | tuple(), notes = any()}

Function Index

add_handler/2Add a handler to receive log events.
call/2Make a synchronous call directly to a specific event handler module.
call/3Make a synchronous call directly to a specific event handler module.
datehour/0Return a four-tuple containing year, month, day, and hour of the current time.
datehour/1Return a four-tuple containing year, month, day, and hour of the specified time.
defer_refresh/1Defer the refresh of a log file.
delete_handler/1Remove a log handler.
fix_log/2
fmt_ip/1Format an IP address or host name.
fmtnow/0Format the current time into a string.
log_access/1Notify registered log event handler of an access event.
log_close/3Close a log file.
log_error/1Notify registered log event handler of an error event.
log_error/3Notify registered log event handler of an error event.
log_info/1Notify registered log event handler of an info event.
log_open/1Open a new log file for writing.
log_open/2Open a new log file for writing.
log_write/2
maybe_rotate/5Rotate a log file if the hour it represents has passed.
month/1Convert numeric month value to the abbreviation.
refresh/2Make a synchronous call to instruct a log handler to refresh itself.
suffix/1
zeropad/2
zone/0

Function Details

add_handler/2

add_handler(Mod::atom() | {atom(), term()}, Args::term()) -> add_handler_result()

Add a handler to receive log events

call/2

call(Mod::atom(), Msg::term()) -> term() | error()

Make a synchronous call directly to a specific event handler module

call/3

call(Mod::atom(), Msg::term(), Timeout::timeout()) -> term() | error()

Make a synchronous call directly to a specific event handler module

datehour/0

datehour() -> datehour()

Return a four-tuple containing year, month, day, and hour of the current time.

datehour/1

datehour(TS::erlang:timestamp()) -> datehour()

Return a four-tuple containing year, month, day, and hour of the specified time.

defer_refresh/1

defer_refresh(Mod::atom()) -> {ok, timer:tref()} | {error, term()}

Defer the refresh of a log file.

delete_handler/1

delete_handler(Mod::atom() | {atom(), term()}) -> delete_handler_result()

Remove a log handler

fix_log/2

fix_log(FD::file:io_device(), Location::non_neg_integer()) -> ok

fmt_ip/1

fmt_ip(IP::undefined | string() | inet:ip4_address() | inet:ip6_address()) -> string()

Format an IP address or host name

fmtnow/0

fmtnow() -> string()

Format the current time into a string

log_access/1

log_access(Wm_log_data::wm_log_data()) -> ok

Notify registered log event handler of an access event.

log_close/3

log_close(Mod::atom(), Name::string(), FD::file:io_device()) -> ok | {error, term()}

Close a log file.

log_error/1

log_error(LogMsg::iolist()) -> ok

Notify registered log event handler of an error event.

log_error/3

log_error(Code::pos_integer(), Req::webmachine_request:t(), Reason::term()) -> ok

Notify registered log event handler of an error event.

log_info/1

log_info(LogMsg::iolist()) -> ok

Notify registered log event handler of an info event.

log_open/1

log_open(FileName::string()) -> {file:io_device(), datehour()}

Open a new log file for writing

log_open/2

log_open(FileName::string(), DateHour::datehour()) -> file:io_device()

Open a new log file for writing

log_write/2

log_write(FD::file:io_device(), IoData::iolist()) -> ok | {error, term()}

maybe_rotate/5

maybe_rotate(Mod::atom(), FileName::string(), Handle::file:io_device(), Time::erlang:timestamp(), Hour::datehour()) -> {datehour(), file:io_device()}

Rotate a log file if the hour it represents has passed.

month/1

month(X1::1..12) -> string()

Convert numeric month value to the abbreviation

refresh/2

refresh(Mod::atom(), Time::erlang:timestamp()) -> ok | {error, term()}

Make a synchronous call to instruct a log handler to refresh itself.

suffix/1

suffix(X1::datehour()) -> string()

zeropad/2

zeropad(Num::integer(), MinLength::integer()) -> string()

zone/0

zone() -> string()


Generated by EDoc