- The ArgL parameter is a list of options which have
+
The ArgL parameter is a list of options which have
the following meanings:
-
-
{name, Log} specifies the name of the log.
+
{name, Log} specifies the name of the log.
This is the name which must be passed on as a parameter in
all subsequent logging operations. A name must always
be supplied.
-
-
{file, FileName} specifies the name of the
+
{file, FileName} specifies the name of the
file which will be used for logged terms. If this value is
omitted and the name of the log is either an atom or a string,
- the file name will default to lists:concat([Log, ".LOG"]) for halt logs. For wrap logs, this will be
+ the file name will default to lists:concat([Log, ".LOG"]) for halt logs. For wrap logs, this will be
the base name of the files. Each file in a wrap log
will be called .N]]>, where N is an
integer. Each wrap log will also have two files called
@@ -817,22 +777,22 @@ The function close/1 closes a
-
-
{linkto, LinkTo}.
+
{linkto, LinkTo}.
If
- LinkTo is a pid, that pid becomes an owner of the
- log. If LinkTo is none the log records
+ LinkTo is a pid, that pid becomes an owner of the
+ log. If LinkTo is none the log records
that it is used anonymously by some process by
incrementing the users counter. By default, the
process which calls open/1 owns the log.
-
-
{repair, Repair}. If Repair is true,
+
{repair, Repair}. If Repair is true,
the current log file will be repaired, if needed. As the
restoration is initiated, a message is output on the error log.
If false is given,
no automatic repair will be attempted. Instead, the
- tuple {error, {need_repair, Log}} is returned if an
+ tuple {error, {need_repair, Log}} is returned if an
attempt is made to open a corrupt log file.
If truncate is given, the log file will
be truncated, creating an empty log. Default is
@@ -841,41 +801,41 @@ If
-
-
{type, Type} is the type of the log. Default
+
{type, Type} is the type of the log. Default
is halt.
-
-
{format, Format} specifies the format of the
+
{format, Format} specifies the format of the
disk log. Default is internal.
-
-
{size, Size} specifies the size of the log.
+
{size, Size} specifies the size of the log.
When a halt log has reached its maximum size, all attempts to
log more items are rejected. The default size is
infinity, which for halt implies that there is no
- maximum size. For wrap logs, the Size parameter
+ maximum size. For wrap logs, the Size parameter
may be either a pair
- {MaxNoBytes, MaxNoFiles} or infinity. In the
+ {MaxNoBytes, MaxNoFiles} or infinity. In the
latter case, if the files of an already existing wrap log
with the same name can be found, the size is read
from the existing wrap log, otherwise an error is returned.
- Wrap logs write at most MaxNoBytes bytes on each file
- and use MaxNoFiles files before starting all over with
- the first wrap log file. Regardless of MaxNoBytes,
+ Wrap logs write at most MaxNoBytes bytes on each file
+ and use MaxNoFiles files before starting all over with
+ the first wrap log file. Regardless of MaxNoBytes,
at least the header (if there is one) and one
item is written on each wrap log file before
wrapping to the next file.
When opening an existing wrap log, it is not
necessary to supply a value for the option Size, but any
supplied value must equal the current size of the log, otherwise
- the tuple {error, {size_mismatch, CurrentSize, NewSize}}
+ the tuple {error, {size_mismatch, CurrentSize, NewSize}}
is returned.
-
-
{distributed, Nodes}. This option can be used for
+
{distributed, Nodes}. This option can be used for
adding members to a distributed disk log. The
default value is [], which means that
the log is local on the current node.
@@ -946,10 +906,10 @@ If
-
-
{head, Head} specifies a header to be
+
{head, Head} specifies a header to be
written first on the log file. If the log is a wrap
- log, the item Head is written first in each new file.
- Head should be a term if the format is
+ log, the item Head is written first in each new file.
+ Head should be a term if the format is
internal, and a deep list of bytes (or a binary)
otherwise. Default is none, which means that
no header is written first on the file.
@@ -966,17 +926,17 @@ If
-
-
{mode, Mode} specifies if the log is to be
+
{mode, Mode} specifies if the log is to be
opened in read-only or read-write mode. It defaults to
read_write.
- The open/1 function returns {ok, Log} if the
+
The open/1 function returns {ok, Log} if the
log file was successfully opened. If the file was
- successfully repaired, the tuple {repaired, Log, {recovered, Rec}, {badbytes, Bad}} is returned, where
- Rec is the number of whole Erlang terms found in the
- file and Bad is the number of bytes in the file which
+ successfully repaired, the tuple {repaired, Log, {recovered, Rec}, {badbytes, Bad}} is returned, where
+ Rec is the number of whole Erlang terms found in the
+ file and Bad is the number of bytes in the file which
were non-Erlang terms. If the distributed parameter
was given, open/1 returns a list of
successful replies and a list of erroneous replies. Each
@@ -988,7 +948,7 @@ If
position after the last logged item, and the logging of items
will commence from there. If the format is internal
and the existing file is not recognized as an internally
- formatted log, a tuple {error, {not_a_log_file, FileName}}
+ formatted log, a tuple {error, {not_a_log_file, FileName}}
is returned.
The open/1 function cannot be used for changing the
@@ -1000,15 +960,15 @@ If
or change_size/2. As a consequence,
none of the options except name is mandatory. If some
given value differs from the current value, a tuple
- {error, {arg_mismatch, OptionName, CurrentValue, Value}}
+ {error, {arg_mismatch, OptionName, CurrentValue, Value}}
is returned. Caution: an owner's attempt to open a log
as owner once again is acknowledged with the return value
- {ok, Log}, but the state of the disk log is not
+ {ok, Log}, but the state of the disk log is not
affected in any way.
If a log with a given name is local on some node,
and one tries to open the log distributed on the same node,
- then the tuple {error, {node_already_open, Name}} is
+ then the tuple {error, {node_already_open, Log}} is
returned. The same tuple is returned if the log is distributed on
some node, and one tries to open the log locally on the same node.
Opening individual distributed disk logs for the first time
@@ -1036,12 +996,8 @@ If