Sophie

Sophie

distrib > Fedora > 17 > x86_64 > by-pkgid > 675c8c8167236dfcf8d66da674f931e8 > files > 908

erlang-doc-R15B-03.3.fc17.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns:fn="http://www.w3.org/2005/02/xpath-functions">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../../doc/otp_doc.css" type="text/css">
<title>Erlang -- disk_log</title>
</head>
<body bgcolor="white" text="#000000" link="#0000ff" vlink="#ff00ff" alink="#ff0000"><div id="container">
<script id="js" type="text/javascript" language="JavaScript" src="../../../../doc/js/flipmenu/flipmenu.js"></script><script id="js2" type="text/javascript" src="../../../../doc/js/erlresolvelinks.js"></script><script language="JavaScript" type="text/javascript">
            <!--
              function getWinHeight() {
                var myHeight = 0;
                if( typeof( window.innerHeight ) == 'number' ) {
                  //Non-IE
                  myHeight = window.innerHeight;
                } else if( document.documentElement && ( document.documentElement.clientWidth ||
                                                         document.documentElement.clientHeight ) ) {
                  //IE 6+ in 'standards compliant mode'
                  myHeight = document.documentElement.clientHeight;
                } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
                  //IE 4 compatible
                  myHeight = document.body.clientHeight;
                }
                return myHeight;
              }

              function setscrollpos() {
                var objf=document.getElementById('loadscrollpos');
                 document.getElementById("leftnav").scrollTop = objf.offsetTop - getWinHeight()/2;
              }

              function addEvent(obj, evType, fn){
                if (obj.addEventListener){
                obj.addEventListener(evType, fn, true);
                return true;
              } else if (obj.attachEvent){
                var r = obj.attachEvent("on"+evType, fn);
                return r;
              } else {
                return false;
              }
             }

             addEvent(window, 'load', setscrollpos);

             //--></script><div id="leftnav"><div class="innertube">
<img alt="Erlang logo" src="../../../../doc/erlang-logo.png"><br><small><a href="index.html">Reference Manual</a><br><a href="release_notes.html">Release Notes</a><br><a href="../pdf/kernel-2.15.3.pdf">PDF</a><br><a href="../../../../doc/index.html">Top</a></small><p><strong>Kernel</strong><br><strong>Reference Manual</strong><br><small>Version 2.15.3</small></p>
<br><a href="javascript:openAllFlips()">Expand All</a><br><a href="javascript:closeAllFlips()">Contract All</a><p><small><strong>Table of Contents</strong></small></p>
<ul class="flipMenu">
<li title="kernel (App)"><a href="kernel_app.html">kernel (App)
                </a></li>
<li id="no" title="application " expanded="false">application<ul>
<li><a href="application.html">
                  Top of manual page
                </a></li>
<li title="get_all_env-0"><a href="application.html#get_all_env-0">get_all_env/0</a></li>
<li title="get_all_env-1"><a href="application.html#get_all_env-1">get_all_env/1</a></li>
<li title="get_all_key-0"><a href="application.html#get_all_key-0">get_all_key/0</a></li>
<li title="get_all_key-1"><a href="application.html#get_all_key-1">get_all_key/1</a></li>
<li title="get_application-0"><a href="application.html#get_application-0">get_application/0</a></li>
<li title="get_application-1"><a href="application.html#get_application-1">get_application/1</a></li>
<li title="get_env-1"><a href="application.html#get_env-1">get_env/1</a></li>
<li title="get_env-2"><a href="application.html#get_env-2">get_env/2</a></li>
<li title="get_key-1"><a href="application.html#get_key-1">get_key/1</a></li>
<li title="get_key-2"><a href="application.html#get_key-2">get_key/2</a></li>
<li title="load-1"><a href="application.html#load-1">load/1</a></li>
<li title="load-2"><a href="application.html#load-2">load/2</a></li>
<li title="loaded_applications-0"><a href="application.html#loaded_applications-0">loaded_applications/0</a></li>
<li title="permit-2"><a href="application.html#permit-2">permit/2</a></li>
<li title="set_env-3"><a href="application.html#set_env-3">set_env/3</a></li>
<li title="set_env-4"><a href="application.html#set_env-4">set_env/4</a></li>
<li title="start-1"><a href="application.html#start-1">start/1</a></li>
<li title="start-2"><a href="application.html#start-2">start/2</a></li>
<li title="start_type-0"><a href="application.html#start_type-0">start_type/0</a></li>
<li title="stop-1"><a href="application.html#stop-1">stop/1</a></li>
<li title="takeover-2"><a href="application.html#takeover-2">takeover/2</a></li>
<li title="unload-1"><a href="application.html#unload-1">unload/1</a></li>
<li title="unset_env-2"><a href="application.html#unset_env-2">unset_env/2</a></li>
<li title="unset_env-3"><a href="application.html#unset_env-3">unset_env/3</a></li>
<li title="which_applications-0"><a href="application.html#which_applications-0">which_applications/0</a></li>
<li title="which_applications-1"><a href="application.html#which_applications-1">which_applications/1</a></li>
<li title="Module:start-2"><a href="application.html#Module:start-2">Module:start/2</a></li>
<li title="Module:start_phase-3"><a href="application.html#Module:start_phase-3">Module:start_phase/3</a></li>
<li title="Module:prep_stop-1"><a href="application.html#Module:prep_stop-1">Module:prep_stop/1</a></li>
<li title="Module:stop-1"><a href="application.html#Module:stop-1">Module:stop/1</a></li>
<li title="Module:config_change-3"><a href="application.html#Module:config_change-3">Module:config_change/3</a></li>
</ul>
</li>
<li id="no" title="auth " expanded="false">auth<ul>
<li><a href="auth.html">
                  Top of manual page
                </a></li>
<li title="is_auth-1"><a href="auth.html#is_auth-1">is_auth/1</a></li>
<li title="cookie-0"><a href="auth.html#cookie-0">cookie/0</a></li>
<li title="cookie-1"><a href="auth.html#cookie-1">cookie/1</a></li>
<li title="node_cookie-1"><a href="auth.html#node_cookie-1">node_cookie/1</a></li>
<li title="node_cookie-2"><a href="auth.html#node_cookie-2">node_cookie/2</a></li>
</ul>
</li>
<li id="no" title="code " expanded="false">code<ul>
<li><a href="code.html">
                  Top of manual page
                </a></li>
<li title="set_path-1"><a href="code.html#set_path-1">set_path/1</a></li>
<li title="get_path-0"><a href="code.html#get_path-0">get_path/0</a></li>
<li title="add_path-1"><a href="code.html#add_path-1">add_path/1</a></li>
<li title="add_pathz-1"><a href="code.html#add_pathz-1">add_pathz/1</a></li>
<li title="add_patha-1"><a href="code.html#add_patha-1">add_patha/1</a></li>
<li title="add_paths-1"><a href="code.html#add_paths-1">add_paths/1</a></li>
<li title="add_pathsz-1"><a href="code.html#add_pathsz-1">add_pathsz/1</a></li>
<li title="add_pathsa-1"><a href="code.html#add_pathsa-1">add_pathsa/1</a></li>
<li title="del_path-1"><a href="code.html#del_path-1">del_path/1</a></li>
<li title="replace_path-2"><a href="code.html#replace_path-2">replace_path/2</a></li>
<li title="load_file-1"><a href="code.html#load_file-1">load_file/1</a></li>
<li title="load_abs-1"><a href="code.html#load_abs-1">load_abs/1</a></li>
<li title="ensure_loaded-1"><a href="code.html#ensure_loaded-1">ensure_loaded/1</a></li>
<li title="load_binary-3"><a href="code.html#load_binary-3">load_binary/3</a></li>
<li title="delete-1"><a href="code.html#delete-1">delete/1</a></li>
<li title="purge-1"><a href="code.html#purge-1">purge/1</a></li>
<li title="soft_purge-1"><a href="code.html#soft_purge-1">soft_purge/1</a></li>
<li title="is_loaded-1"><a href="code.html#is_loaded-1">is_loaded/1</a></li>
<li title="all_loaded-0"><a href="code.html#all_loaded-0">all_loaded/0</a></li>
<li title="which-1"><a href="code.html#which-1">which/1</a></li>
<li title="get_object_code-1"><a href="code.html#get_object_code-1">get_object_code/1</a></li>
<li title="root_dir-0"><a href="code.html#root_dir-0">root_dir/0</a></li>
<li title="lib_dir-0"><a href="code.html#lib_dir-0">lib_dir/0</a></li>
<li title="lib_dir-1"><a href="code.html#lib_dir-1">lib_dir/1</a></li>
<li title="lib_dir-2"><a href="code.html#lib_dir-2">lib_dir/2</a></li>
<li title="compiler_dir-0"><a href="code.html#compiler_dir-0">compiler_dir/0</a></li>
<li title="priv_dir-1"><a href="code.html#priv_dir-1">priv_dir/1</a></li>
<li title="objfile_extension-0"><a href="code.html#objfile_extension-0">objfile_extension/0</a></li>
<li title="stick_dir-1"><a href="code.html#stick_dir-1">stick_dir/1</a></li>
<li title="unstick_dir-1"><a href="code.html#unstick_dir-1">unstick_dir/1</a></li>
<li title="is_sticky-1"><a href="code.html#is_sticky-1">is_sticky/1</a></li>
<li title="rehash-0"><a href="code.html#rehash-0">rehash/0</a></li>
<li title="where_is_file-1"><a href="code.html#where_is_file-1">where_is_file/1</a></li>
<li title="clash-0"><a href="code.html#clash-0">clash/0</a></li>
<li title="is_module_native-1"><a href="code.html#is_module_native-1">is_module_native/1</a></li>
</ul>
</li>
<li id="loadscrollpos" title="disk_log " expanded="true">disk_log<ul>
<li><a href="disk_log.html">
                  Top of manual page
                </a></li>
<li title="accessible_logs-0"><a href="disk_log.html#accessible_logs-0">accessible_logs/0</a></li>
<li title="alog-2"><a href="disk_log.html#alog-2">alog/2</a></li>
<li title="balog-2"><a href="disk_log.html#balog-2">balog/2</a></li>
<li title="alog_terms-2"><a href="disk_log.html#alog_terms-2">alog_terms/2</a></li>
<li title="balog_terms-2"><a href="disk_log.html#balog_terms-2">balog_terms/2</a></li>
<li title="block-1"><a href="disk_log.html#block-1">block/1</a></li>
<li title="block-2"><a href="disk_log.html#block-2">block/2</a></li>
<li title="change_header-2"><a href="disk_log.html#change_header-2">change_header/2</a></li>
<li title="change_notify-3"><a href="disk_log.html#change_notify-3">change_notify/3</a></li>
<li title="change_size-2"><a href="disk_log.html#change_size-2">change_size/2</a></li>
<li title="chunk-2"><a href="disk_log.html#chunk-2">chunk/2</a></li>
<li title="chunk-3"><a href="disk_log.html#chunk-3">chunk/3</a></li>
<li title="bchunk-2"><a href="disk_log.html#bchunk-2">bchunk/2</a></li>
<li title="bchunk-3"><a href="disk_log.html#bchunk-3">bchunk/3</a></li>
<li title="chunk_info-1"><a href="disk_log.html#chunk_info-1">chunk_info/1</a></li>
<li title="chunk_step-3"><a href="disk_log.html#chunk_step-3">chunk_step/3</a></li>
<li title="close-1"><a href="disk_log.html#close-1">close/1</a></li>
<li title="format_error-1"><a href="disk_log.html#format_error-1">format_error/1</a></li>
<li title="inc_wrap_file-1"><a href="disk_log.html#inc_wrap_file-1">inc_wrap_file/1</a></li>
<li title="info-1"><a href="disk_log.html#info-1">info/1</a></li>
<li title="lclose-1"><a href="disk_log.html#lclose-1">lclose/1</a></li>
<li title="lclose-2"><a href="disk_log.html#lclose-2">lclose/2</a></li>
<li title="log-2"><a href="disk_log.html#log-2">log/2</a></li>
<li title="blog-2"><a href="disk_log.html#blog-2">blog/2</a></li>
<li title="log_terms-2"><a href="disk_log.html#log_terms-2">log_terms/2</a></li>
<li title="blog_terms-2"><a href="disk_log.html#blog_terms-2">blog_terms/2</a></li>
<li title="open-1"><a href="disk_log.html#open-1">open/1</a></li>
<li title="pid2name-1"><a href="disk_log.html#pid2name-1">pid2name/1</a></li>
<li title="reopen-2"><a href="disk_log.html#reopen-2">reopen/2</a></li>
<li title="reopen-3"><a href="disk_log.html#reopen-3">reopen/3</a></li>
<li title="breopen-3"><a href="disk_log.html#breopen-3">breopen/3</a></li>
<li title="sync-1"><a href="disk_log.html#sync-1">sync/1</a></li>
<li title="truncate-1"><a href="disk_log.html#truncate-1">truncate/1</a></li>
<li title="truncate-2"><a href="disk_log.html#truncate-2">truncate/2</a></li>
<li title="btruncate-2"><a href="disk_log.html#btruncate-2">btruncate/2</a></li>
<li title="unblock-1"><a href="disk_log.html#unblock-1">unblock/1</a></li>
</ul>
</li>
<li id="no" title="erl_boot_server " expanded="false">erl_boot_server<ul>
<li><a href="erl_boot_server.html">
                  Top of manual page
                </a></li>
<li title="start-1"><a href="erl_boot_server.html#start-1">start/1</a></li>
<li title="start_link-1"><a href="erl_boot_server.html#start_link-1">start_link/1</a></li>
<li title="add_slave-1"><a href="erl_boot_server.html#add_slave-1">add_slave/1</a></li>
<li title="delete_slave-1"><a href="erl_boot_server.html#delete_slave-1">delete_slave/1</a></li>
<li title="which_slaves-0"><a href="erl_boot_server.html#which_slaves-0">which_slaves/0</a></li>
</ul>
</li>
<li id="no" title="erl_ddll " expanded="false">erl_ddll<ul>
<li><a href="erl_ddll.html">
                  Top of manual page
                </a></li>
<li title="demonitor-1"><a href="erl_ddll.html#demonitor-1">demonitor/1</a></li>
<li title="info-0"><a href="erl_ddll.html#info-0">info/0</a></li>
<li title="info-1"><a href="erl_ddll.html#info-1">info/1</a></li>
<li title="info-2"><a href="erl_ddll.html#info-2">info/2</a></li>
<li title="load-2"><a href="erl_ddll.html#load-2">load/2</a></li>
<li title="load_driver-2"><a href="erl_ddll.html#load_driver-2">load_driver/2</a></li>
<li title="monitor-2"><a href="erl_ddll.html#monitor-2">monitor/2</a></li>
<li title="reload-2"><a href="erl_ddll.html#reload-2">reload/2</a></li>
<li title="reload_driver-2"><a href="erl_ddll.html#reload_driver-2">reload_driver/2</a></li>
<li title="try_load-3"><a href="erl_ddll.html#try_load-3">try_load/3</a></li>
<li title="try_unload-2"><a href="erl_ddll.html#try_unload-2">try_unload/2</a></li>
<li title="unload-1"><a href="erl_ddll.html#unload-1">unload/1</a></li>
<li title="unload_driver-1"><a href="erl_ddll.html#unload_driver-1">unload_driver/1</a></li>
<li title="loaded_drivers-0"><a href="erl_ddll.html#loaded_drivers-0">loaded_drivers/0</a></li>
<li title="format_error-1"><a href="erl_ddll.html#format_error-1">format_error/1</a></li>
</ul>
</li>
<li title="erl_prim_loader"><a href="erl_prim_loader.html">erl_prim_loader</a></li>
<li title="erlang"><a href="erlang.html">erlang</a></li>
<li id="no" title="error_handler " expanded="false">error_handler<ul>
<li><a href="error_handler.html">
                  Top of manual page
                </a></li>
<li title="undefined_function-3"><a href="error_handler.html#undefined_function-3">undefined_function/3</a></li>
<li title="undefined_lambda-3"><a href="error_handler.html#undefined_lambda-3">undefined_lambda/3</a></li>
</ul>
</li>
<li id="no" title="error_logger " expanded="false">error_logger<ul>
<li><a href="error_logger.html">
                  Top of manual page
                </a></li>
<li title="error_msg-1"><a href="error_logger.html#error_msg-1">error_msg/1</a></li>
<li title="error_msg-2"><a href="error_logger.html#error_msg-2">error_msg/2</a></li>
<li title="format-2"><a href="error_logger.html#format-2">format/2</a></li>
<li title="error_report-1"><a href="error_logger.html#error_report-1">error_report/1</a></li>
<li title="error_report-2"><a href="error_logger.html#error_report-2">error_report/2</a></li>
<li title="warning_map-0"><a href="error_logger.html#warning_map-0">warning_map/0</a></li>
<li title="warning_msg-1"><a href="error_logger.html#warning_msg-1">warning_msg/1</a></li>
<li title="warning_msg-2"><a href="error_logger.html#warning_msg-2">warning_msg/2</a></li>
<li title="warning_report-1"><a href="error_logger.html#warning_report-1">warning_report/1</a></li>
<li title="warning_report-2"><a href="error_logger.html#warning_report-2">warning_report/2</a></li>
<li title="info_msg-1"><a href="error_logger.html#info_msg-1">info_msg/1</a></li>
<li title="info_msg-2"><a href="error_logger.html#info_msg-2">info_msg/2</a></li>
<li title="info_report-1"><a href="error_logger.html#info_report-1">info_report/1</a></li>
<li title="info_report-2"><a href="error_logger.html#info_report-2">info_report/2</a></li>
<li title="add_report_handler-1"><a href="error_logger.html#add_report_handler-1">add_report_handler/1</a></li>
<li title="add_report_handler-2"><a href="error_logger.html#add_report_handler-2">add_report_handler/2</a></li>
<li title="delete_report_handler-1"><a href="error_logger.html#delete_report_handler-1">delete_report_handler/1</a></li>
<li title="tty-1"><a href="error_logger.html#tty-1">tty/1</a></li>
<li title="logfile-1"><a href="error_logger.html#logfile-1">logfile/1</a></li>
</ul>
</li>
<li id="no" title="file " expanded="false">file<ul>
<li><a href="file.html">
                  Top of manual page
                </a></li>
<li title="advise-4"><a href="file.html#advise-4">advise/4</a></li>
<li title="change_group-2"><a href="file.html#change_group-2">change_group/2</a></li>
<li title="change_mode-2"><a href="file.html#change_mode-2">change_mode/2</a></li>
<li title="change_owner-2"><a href="file.html#change_owner-2">change_owner/2</a></li>
<li title="change_owner-3"><a href="file.html#change_owner-3">change_owner/3</a></li>
<li title="change_time-2"><a href="file.html#change_time-2">change_time/2</a></li>
<li title="change_time-3"><a href="file.html#change_time-3">change_time/3</a></li>
<li title="close-1"><a href="file.html#close-1">close/1</a></li>
<li title="consult-1"><a href="file.html#consult-1">consult/1</a></li>
<li title="copy-2"><a href="file.html#copy-2">copy/2</a></li>
<li title="copy-3"><a href="file.html#copy-3">copy/3</a></li>
<li title="del_dir-1"><a href="file.html#del_dir-1">del_dir/1</a></li>
<li title="delete-1"><a href="file.html#delete-1">delete/1</a></li>
<li title="eval-1"><a href="file.html#eval-1">eval/1</a></li>
<li title="eval-2"><a href="file.html#eval-2">eval/2</a></li>
<li title="file_info-1"><a href="file.html#file_info-1">file_info/1</a></li>
<li title="format_error-1"><a href="file.html#format_error-1">format_error/1</a></li>
<li title="get_cwd-0"><a href="file.html#get_cwd-0">get_cwd/0</a></li>
<li title="get_cwd-1"><a href="file.html#get_cwd-1">get_cwd/1</a></li>
<li title="list_dir-1"><a href="file.html#list_dir-1">list_dir/1</a></li>
<li title="make_dir-1"><a href="file.html#make_dir-1">make_dir/1</a></li>
<li title="make_link-2"><a href="file.html#make_link-2">make_link/2</a></li>
<li title="make_symlink-2"><a href="file.html#make_symlink-2">make_symlink/2</a></li>
<li title="native_name_encoding-0"><a href="file.html#native_name_encoding-0">native_name_encoding/0</a></li>
<li title="open-2"><a href="file.html#open-2">open/2</a></li>
<li title="path_consult-2"><a href="file.html#path_consult-2">path_consult/2</a></li>
<li title="path_eval-2"><a href="file.html#path_eval-2">path_eval/2</a></li>
<li title="path_open-3"><a href="file.html#path_open-3">path_open/3</a></li>
<li title="path_script-2"><a href="file.html#path_script-2">path_script/2</a></li>
<li title="path_script-3"><a href="file.html#path_script-3">path_script/3</a></li>
<li title="pid2name-1"><a href="file.html#pid2name-1">pid2name/1</a></li>
<li title="position-2"><a href="file.html#position-2">position/2</a></li>
<li title="pread-2"><a href="file.html#pread-2">pread/2</a></li>
<li title="pread-3"><a href="file.html#pread-3">pread/3</a></li>
<li title="pwrite-2"><a href="file.html#pwrite-2">pwrite/2</a></li>
<li title="pwrite-3"><a href="file.html#pwrite-3">pwrite/3</a></li>
<li title="read-2"><a href="file.html#read-2">read/2</a></li>
<li title="read_file-1"><a href="file.html#read_file-1">read_file/1</a></li>
<li title="read_file_info-1"><a href="file.html#read_file_info-1">read_file_info/1</a></li>
<li title="read_file_info-2"><a href="file.html#read_file_info-2">read_file_info/2</a></li>
<li title="read_line-1"><a href="file.html#read_line-1">read_line/1</a></li>
<li title="read_link-1"><a href="file.html#read_link-1">read_link/1</a></li>
<li title="read_link_info-1"><a href="file.html#read_link_info-1">read_link_info/1</a></li>
<li title="read_link_info-2"><a href="file.html#read_link_info-2">read_link_info/2</a></li>
<li title="rename-2"><a href="file.html#rename-2">rename/2</a></li>
<li title="script-1"><a href="file.html#script-1">script/1</a></li>
<li title="script-2"><a href="file.html#script-2">script/2</a></li>
<li title="set_cwd-1"><a href="file.html#set_cwd-1">set_cwd/1</a></li>
<li title="sync-1"><a href="file.html#sync-1">sync/1</a></li>
<li title="datasync-1"><a href="file.html#datasync-1">datasync/1</a></li>
<li title="truncate-1"><a href="file.html#truncate-1">truncate/1</a></li>
<li title="sendfile-2"><a href="file.html#sendfile-2">sendfile/2</a></li>
<li title="sendfile-5"><a href="file.html#sendfile-5">sendfile/5</a></li>
<li title="write-2"><a href="file.html#write-2">write/2</a></li>
<li title="write_file-2"><a href="file.html#write_file-2">write_file/2</a></li>
<li title="write_file-3"><a href="file.html#write_file-3">write_file/3</a></li>
<li title="write_file_info-2"><a href="file.html#write_file_info-2">write_file_info/2</a></li>
<li title="write_file_info-3"><a href="file.html#write_file_info-3">write_file_info/3</a></li>
</ul>
</li>
<li id="no" title="gen_tcp " expanded="false">gen_tcp<ul>
<li><a href="gen_tcp.html">
                  Top of manual page
                </a></li>
<li title="connect-3"><a href="gen_tcp.html#connect-3">connect/3</a></li>
<li title="connect-4"><a href="gen_tcp.html#connect-4">connect/4</a></li>
<li title="listen-2"><a href="gen_tcp.html#listen-2">listen/2</a></li>
<li title="accept-1"><a href="gen_tcp.html#accept-1">accept/1</a></li>
<li title="accept-2"><a href="gen_tcp.html#accept-2">accept/2</a></li>
<li title="send-2"><a href="gen_tcp.html#send-2">send/2</a></li>
<li title="recv-2"><a href="gen_tcp.html#recv-2">recv/2</a></li>
<li title="recv-3"><a href="gen_tcp.html#recv-3">recv/3</a></li>
<li title="controlling_process-2"><a href="gen_tcp.html#controlling_process-2">controlling_process/2</a></li>
<li title="close-1"><a href="gen_tcp.html#close-1">close/1</a></li>
<li title="shutdown-2"><a href="gen_tcp.html#shutdown-2">shutdown/2</a></li>
</ul>
</li>
<li id="no" title="gen_udp " expanded="false">gen_udp<ul>
<li><a href="gen_udp.html">
                  Top of manual page
                </a></li>
<li title="open-1"><a href="gen_udp.html#open-1">open/1</a></li>
<li title="open-2"><a href="gen_udp.html#open-2">open/2</a></li>
<li title="send-4"><a href="gen_udp.html#send-4">send/4</a></li>
<li title="recv-2"><a href="gen_udp.html#recv-2">recv/2</a></li>
<li title="recv-3"><a href="gen_udp.html#recv-3">recv/3</a></li>
<li title="controlling_process-2"><a href="gen_udp.html#controlling_process-2">controlling_process/2</a></li>
<li title="close-1"><a href="gen_udp.html#close-1">close/1</a></li>
</ul>
</li>
<li id="no" title="gen_sctp " expanded="false">gen_sctp<ul>
<li><a href="gen_sctp.html">
                  Top of manual page
                </a></li>
<li title="abort-2"><a href="gen_sctp.html#abort-2">abort/2</a></li>
<li title="close-1"><a href="gen_sctp.html#close-1">close/1</a></li>
<li title="connect-4"><a href="gen_sctp.html#connect-4">connect/4</a></li>
<li title="connect-5"><a href="gen_sctp.html#connect-5">connect/5</a></li>
<li title="connect_init-4"><a href="gen_sctp.html#connect_init-4">connect_init/4</a></li>
<li title="connect_init-5"><a href="gen_sctp.html#connect_init-5">connect_init/5</a></li>
<li title="controlling_process-2"><a href="gen_sctp.html#controlling_process-2">controlling_process/2</a></li>
<li title="eof-2"><a href="gen_sctp.html#eof-2">eof/2</a></li>
<li title="listen-2"><a href="gen_sctp.html#listen-2">listen/2</a></li>
<li title="open-0"><a href="gen_sctp.html#open-0">open/0</a></li>
<li title="open-1"><a href="gen_sctp.html#open-1">open/1</a></li>
<li title="open-2"><a href="gen_sctp.html#open-2">open/2</a></li>
<li title="peeloff-2"><a href="gen_sctp.html#peeloff-2">peeloff/2</a></li>
<li title="recv-1"><a href="gen_sctp.html#recv-1">recv/1</a></li>
<li title="recv-2"><a href="gen_sctp.html#recv-2">recv/2</a></li>
<li title="send-3"><a href="gen_sctp.html#send-3">send/3</a></li>
<li title="send-4"><a href="gen_sctp.html#send-4">send/4</a></li>
<li title="error_string-1"><a href="gen_sctp.html#error_string-1">error_string/1</a></li>
</ul>
</li>
<li id="no" title="global " expanded="false">global<ul>
<li><a href="global.html">
                  Top of manual page
                </a></li>
<li title="del_lock-1"><a href="global.html#del_lock-1">del_lock/1</a></li>
<li title="del_lock-2"><a href="global.html#del_lock-2">del_lock/2</a></li>
<li title="notify_all_name-3"><a href="global.html#notify_all_name-3">notify_all_name/3</a></li>
<li title="random_exit_name-3"><a href="global.html#random_exit_name-3">random_exit_name/3</a></li>
<li title="random_notify_name-3"><a href="global.html#random_notify_name-3">random_notify_name/3</a></li>
<li title="register_name-2"><a href="global.html#register_name-2">register_name/2</a></li>
<li title="register_name-3"><a href="global.html#register_name-3">register_name/3</a></li>
<li title="registered_names-0"><a href="global.html#registered_names-0">registered_names/0</a></li>
<li title="re_register_name-2"><a href="global.html#re_register_name-2">re_register_name/2</a></li>
<li title="re_register_name-3"><a href="global.html#re_register_name-3">re_register_name/3</a></li>
<li title="send-2"><a href="global.html#send-2">send/2</a></li>
<li title="set_lock-1"><a href="global.html#set_lock-1">set_lock/1</a></li>
<li title="set_lock-2"><a href="global.html#set_lock-2">set_lock/2</a></li>
<li title="set_lock-3"><a href="global.html#set_lock-3">set_lock/3</a></li>
<li title="sync-0"><a href="global.html#sync-0">sync/0</a></li>
<li title="trans-2"><a href="global.html#trans-2">trans/2</a></li>
<li title="trans-3"><a href="global.html#trans-3">trans/3</a></li>
<li title="trans-4"><a href="global.html#trans-4">trans/4</a></li>
<li title="unregister_name-1"><a href="global.html#unregister_name-1">unregister_name/1</a></li>
<li title="whereis_name-1"><a href="global.html#whereis_name-1">whereis_name/1</a></li>
</ul>
</li>
<li id="no" title="global_group " expanded="false">global_group<ul>
<li><a href="global_group.html">
                  Top of manual page
                </a></li>
<li title="global_groups-0"><a href="global_group.html#global_groups-0">global_groups/0</a></li>
<li title="info-0"><a href="global_group.html#info-0">info/0</a></li>
<li title="monitor_nodes-1"><a href="global_group.html#monitor_nodes-1">monitor_nodes/1</a></li>
<li title="own_nodes-0"><a href="global_group.html#own_nodes-0">own_nodes/0</a></li>
<li title="registered_names-1"><a href="global_group.html#registered_names-1">registered_names/1</a></li>
<li title="send-2"><a href="global_group.html#send-2">send/2</a></li>
<li title="send-3"><a href="global_group.html#send-3">send/3</a></li>
<li title="sync-0"><a href="global_group.html#sync-0">sync/0</a></li>
<li title="whereis_name-1"><a href="global_group.html#whereis_name-1">whereis_name/1</a></li>
<li title="whereis_name-2"><a href="global_group.html#whereis_name-2">whereis_name/2</a></li>
</ul>
</li>
<li id="no" title="heart " expanded="false">heart<ul>
<li><a href="heart.html">
                  Top of manual page
                </a></li>
<li title="set_cmd-1"><a href="heart.html#set_cmd-1">set_cmd/1</a></li>
<li title="clear_cmd-0"><a href="heart.html#clear_cmd-0">clear_cmd/0</a></li>
<li title="get_cmd-0"><a href="heart.html#get_cmd-0">get_cmd/0</a></li>
</ul>
</li>
<li id="no" title="inet " expanded="false">inet<ul>
<li><a href="inet.html">
                  Top of manual page
                </a></li>
<li title="close-1"><a href="inet.html#close-1">close/1</a></li>
<li title="get_rc-0"><a href="inet.html#get_rc-0">get_rc/0</a></li>
<li title="format_error-1"><a href="inet.html#format_error-1">format_error/1</a></li>
<li title="getaddr-2"><a href="inet.html#getaddr-2">getaddr/2</a></li>
<li title="getaddrs-2"><a href="inet.html#getaddrs-2">getaddrs/2</a></li>
<li title="gethostbyaddr-1"><a href="inet.html#gethostbyaddr-1">gethostbyaddr/1</a></li>
<li title="gethostbyname-1"><a href="inet.html#gethostbyname-1">gethostbyname/1</a></li>
<li title="gethostbyname-2"><a href="inet.html#gethostbyname-2">gethostbyname/2</a></li>
<li title="gethostname-0"><a href="inet.html#gethostname-0">gethostname/0</a></li>
<li title="getifaddrs-0"><a href="inet.html#getifaddrs-0">getifaddrs/0</a></li>
<li title="getopts-2"><a href="inet.html#getopts-2">getopts/2</a></li>
<li title="getstat-1"><a href="inet.html#getstat-1">getstat/1</a></li>
<li title="getstat-2"><a href="inet.html#getstat-2">getstat/2</a></li>
<li title="peername-1"><a href="inet.html#peername-1">peername/1</a></li>
<li title="port-1"><a href="inet.html#port-1">port/1</a></li>
<li title="sockname-1"><a href="inet.html#sockname-1">sockname/1</a></li>
<li title="setopts-2"><a href="inet.html#setopts-2">setopts/2</a></li>
</ul>
</li>
<li id="no" title="inet_res " expanded="false">inet_res<ul>
<li><a href="inet_res.html">
                  Top of manual page
                </a></li>
<li title="getbyname-2"><a href="inet_res.html#getbyname-2">getbyname/2</a></li>
<li title="getbyname-3"><a href="inet_res.html#getbyname-3">getbyname/3</a></li>
<li title="gethostbyaddr-1"><a href="inet_res.html#gethostbyaddr-1">gethostbyaddr/1</a></li>
<li title="gethostbyaddr-2"><a href="inet_res.html#gethostbyaddr-2">gethostbyaddr/2</a></li>
<li title="gethostbyname-1"><a href="inet_res.html#gethostbyname-1">gethostbyname/1</a></li>
<li title="gethostbyname-2"><a href="inet_res.html#gethostbyname-2">gethostbyname/2</a></li>
<li title="gethostbyname-3"><a href="inet_res.html#gethostbyname-3">gethostbyname/3</a></li>
<li title="lookup-3"><a href="inet_res.html#lookup-3">lookup/3</a></li>
<li title="lookup-4"><a href="inet_res.html#lookup-4">lookup/4</a></li>
<li title="lookup-5"><a href="inet_res.html#lookup-5">lookup/5</a></li>
<li title="resolve-3"><a href="inet_res.html#resolve-3">resolve/3</a></li>
<li title="resolve-4"><a href="inet_res.html#resolve-4">resolve/4</a></li>
<li title="resolve-5"><a href="inet_res.html#resolve-5">resolve/5</a></li>
<li title="nslookup-3"><a href="inet_res.html#nslookup-3">nslookup/3</a></li>
<li title="nslookup-4"><a href="inet_res.html#nslookup-4">nslookup/4</a></li>
<li title="nnslookup-4"><a href="inet_res.html#nnslookup-4">nnslookup/4</a></li>
<li title="nnslookup-5"><a href="inet_res.html#nnslookup-5">nnslookup/5</a></li>
</ul>
</li>
<li title="init"><a href="init.html">init</a></li>
<li id="no" title="net_adm " expanded="false">net_adm<ul>
<li><a href="net_adm.html">
                  Top of manual page
                </a></li>
<li title="dns_hostname-1"><a href="net_adm.html#dns_hostname-1">dns_hostname/1</a></li>
<li title="host_file-0"><a href="net_adm.html#host_file-0">host_file/0</a></li>
<li title="localhost-0"><a href="net_adm.html#localhost-0">localhost/0</a></li>
<li title="names-0"><a href="net_adm.html#names-0">names/0</a></li>
<li title="names-1"><a href="net_adm.html#names-1">names/1</a></li>
<li title="ping-1"><a href="net_adm.html#ping-1">ping/1</a></li>
<li title="world-0"><a href="net_adm.html#world-0">world/0</a></li>
<li title="world-1"><a href="net_adm.html#world-1">world/1</a></li>
<li title="world_list-1"><a href="net_adm.html#world_list-1">world_list/1</a></li>
<li title="world_list-2"><a href="net_adm.html#world_list-2">world_list/2</a></li>
</ul>
</li>
<li id="no" title="net_kernel " expanded="false">net_kernel<ul>
<li><a href="net_kernel.html">
                  Top of manual page
                </a></li>
<li title="allow-1"><a href="net_kernel.html#allow-1">allow/1</a></li>
<li title="connect_node-1"><a href="net_kernel.html#connect_node-1">connect_node/1</a></li>
<li title="monitor_nodes-1"><a href="net_kernel.html#monitor_nodes-1">monitor_nodes/1</a></li>
<li title="monitor_nodes-2"><a href="net_kernel.html#monitor_nodes-2">monitor_nodes/2</a></li>
<li title="get_net_ticktime-0"><a href="net_kernel.html#get_net_ticktime-0">get_net_ticktime/0</a></li>
<li title="set_net_ticktime-1"><a href="net_kernel.html#set_net_ticktime-1">set_net_ticktime/1</a></li>
<li title="set_net_ticktime-2"><a href="net_kernel.html#set_net_ticktime-2">set_net_ticktime/2</a></li>
<li title="start-1"><a href="net_kernel.html#start-1">start/1</a></li>
<li title="start-1"><a href="net_kernel.html#start-1">start/1</a></li>
<li title="start-1"><a href="net_kernel.html#start-1">start/1</a></li>
<li title="stop-0"><a href="net_kernel.html#stop-0">stop/0</a></li>
</ul>
</li>
<li id="no" title="os " expanded="false">os<ul>
<li><a href="os.html">
                  Top of manual page
                </a></li>
<li title="cmd-1"><a href="os.html#cmd-1">cmd/1</a></li>
<li title="find_executable-1"><a href="os.html#find_executable-1">find_executable/1</a></li>
<li title="find_executable-2"><a href="os.html#find_executable-2">find_executable/2</a></li>
<li title="getenv-0"><a href="os.html#getenv-0">getenv/0</a></li>
<li title="getenv-1"><a href="os.html#getenv-1">getenv/1</a></li>
<li title="getpid-0"><a href="os.html#getpid-0">getpid/0</a></li>
<li title="putenv-2"><a href="os.html#putenv-2">putenv/2</a></li>
<li title="timestamp-0"><a href="os.html#timestamp-0">timestamp/0</a></li>
<li title="type-0"><a href="os.html#type-0">type/0</a></li>
<li title="version-0"><a href="os.html#version-0">version/0</a></li>
</ul>
</li>
<li id="no" title="pg2 " expanded="false">pg2<ul>
<li><a href="pg2.html">
                  Top of manual page
                </a></li>
<li title="create-1"><a href="pg2.html#create-1">create/1</a></li>
<li title="delete-1"><a href="pg2.html#delete-1">delete/1</a></li>
<li title="get_closest_pid-1"><a href="pg2.html#get_closest_pid-1">get_closest_pid/1</a></li>
<li title="get_members-1"><a href="pg2.html#get_members-1">get_members/1</a></li>
<li title="get_local_members-1"><a href="pg2.html#get_local_members-1">get_local_members/1</a></li>
<li title="join-2"><a href="pg2.html#join-2">join/2</a></li>
<li title="leave-2"><a href="pg2.html#leave-2">leave/2</a></li>
<li title="which_groups-0"><a href="pg2.html#which_groups-0">which_groups/0</a></li>
<li title="start-0"><a href="pg2.html#start-0">start/0</a></li>
<li title="start_link-0"><a href="pg2.html#start_link-0">start_link/0</a></li>
</ul>
</li>
<li id="no" title="rpc " expanded="false">rpc<ul>
<li><a href="rpc.html">
                  Top of manual page
                </a></li>
<li title="call-4"><a href="rpc.html#call-4">call/4</a></li>
<li title="call-5"><a href="rpc.html#call-5">call/5</a></li>
<li title="block_call-4"><a href="rpc.html#block_call-4">block_call/4</a></li>
<li title="block_call-5"><a href="rpc.html#block_call-5">block_call/5</a></li>
<li title="async_call-4"><a href="rpc.html#async_call-4">async_call/4</a></li>
<li title="yield-1"><a href="rpc.html#yield-1">yield/1</a></li>
<li title="nb_yield-1"><a href="rpc.html#nb_yield-1">nb_yield/1</a></li>
<li title="nb_yield-2"><a href="rpc.html#nb_yield-2">nb_yield/2</a></li>
<li title="multicall-3"><a href="rpc.html#multicall-3">multicall/3</a></li>
<li title="multicall-4"><a href="rpc.html#multicall-4">multicall/4</a></li>
<li title="multicall-5"><a href="rpc.html#multicall-5">multicall/5</a></li>
<li title="cast-4"><a href="rpc.html#cast-4">cast/4</a></li>
<li title="eval_everywhere-3"><a href="rpc.html#eval_everywhere-3">eval_everywhere/3</a></li>
<li title="eval_everywhere-4"><a href="rpc.html#eval_everywhere-4">eval_everywhere/4</a></li>
<li title="abcast-2"><a href="rpc.html#abcast-2">abcast/2</a></li>
<li title="abcast-3"><a href="rpc.html#abcast-3">abcast/3</a></li>
<li title="sbcast-2"><a href="rpc.html#sbcast-2">sbcast/2</a></li>
<li title="sbcast-3"><a href="rpc.html#sbcast-3">sbcast/3</a></li>
<li title="server_call-4"><a href="rpc.html#server_call-4">server_call/4</a></li>
<li title="multi_server_call-2"><a href="rpc.html#multi_server_call-2">multi_server_call/2</a></li>
<li title="multi_server_call-3"><a href="rpc.html#multi_server_call-3">multi_server_call/3</a></li>
<li title="safe_multi_server_call-2"><a href="rpc.html#safe_multi_server_call-2">safe_multi_server_call/2</a></li>
<li title="safe_multi_server_call-3"><a href="rpc.html#safe_multi_server_call-3">safe_multi_server_call/3</a></li>
<li title="parallel_eval-1"><a href="rpc.html#parallel_eval-1">parallel_eval/1</a></li>
<li title="pmap-3"><a href="rpc.html#pmap-3">pmap/3</a></li>
<li title="pinfo-1"><a href="rpc.html#pinfo-1">pinfo/1</a></li>
<li title="pinfo-2"><a href="rpc.html#pinfo-2">pinfo/2</a></li>
</ul>
</li>
<li id="no" title="seq_trace " expanded="false">seq_trace<ul>
<li><a href="seq_trace.html">
                  Top of manual page
                </a></li>
<li title="set_token-1"><a href="seq_trace.html#set_token-1">set_token/1</a></li>
<li title="set_token-2"><a href="seq_trace.html#set_token-2">set_token/2</a></li>
<li title="get_token-0"><a href="seq_trace.html#get_token-0">get_token/0</a></li>
<li title="get_token-1"><a href="seq_trace.html#get_token-1">get_token/1</a></li>
<li title="print-1"><a href="seq_trace.html#print-1">print/1</a></li>
<li title="print-2"><a href="seq_trace.html#print-2">print/2</a></li>
<li title="reset_trace-0"><a href="seq_trace.html#reset_trace-0">reset_trace/0</a></li>
<li title="set_system_tracer-1"><a href="seq_trace.html#set_system_tracer-1">set_system_tracer/1</a></li>
<li title="get_system_tracer-0"><a href="seq_trace.html#get_system_tracer-0">get_system_tracer/0</a></li>
</ul>
</li>
<li title="user"><a href="user.html">user</a></li>
<li id="no" title="wrap_log_reader " expanded="false">wrap_log_reader<ul>
<li><a href="wrap_log_reader.html">
                  Top of manual page
                </a></li>
<li title="chunk-1"><a href="wrap_log_reader.html#chunk-1">chunk/1</a></li>
<li title="chunk-2"><a href="wrap_log_reader.html#chunk-2">chunk/2</a></li>
<li title="close-1"><a href="wrap_log_reader.html#close-1">close/1</a></li>
<li title="open-1"><a href="wrap_log_reader.html#open-1">open/1</a></li>
<li title="open-2"><a href="wrap_log_reader.html#open-2">open/2</a></li>
</ul>
</li>
<li title="zlib"><a href="zlib.html">zlib</a></li>
<li title="app"><a href="app.html">app</a></li>
<li title="config"><a href="config.html">config</a></li>
<li title="packages"><a href="packages.html">packages</a></li>
</ul>
</div></div>
<div id="content">
<div class="innertube">
<!-- refpage --><center><h1>disk_log</h1></center>
  
  <h3>MODULE</h3>
<div class="REFBODY">disk_log</div>
  <h3>MODULE SUMMARY</h3>
<div class="REFBODY">A disk based term logging facility</div>
  <h3>DESCRIPTION</h3>
<div class="REFBODY"><p>
    <p><span class="code">disk_log</span> is a disk based term logger which makes
      it possible to efficiently log items on files. 
      Two types of logs are supported,
      <strong>halt logs</strong> and <strong>wrap logs</strong>. A halt log
      appends items to a single file, the size of which may or may
      not be limited by the disk log module, whereas a wrap log utilizes
      a sequence of wrap log files of limited size. As a wrap log file
      has been filled up, further items are logged onto to the next 
      file in the sequence, starting all over with the first file when 
      the last file has been filled up. For the sake of efficiency, 
      items are always written to files as binaries.
      </p>
    <p>Two formats of the log files are supported, the <strong>internal format</strong> and the <strong>external format</strong>. The internal
      format supports automatic repair of log files that have not been
      properly closed, and makes it possible to efficiently read
      logged items in <strong>chunks</strong> using a set of functions defined
      in this module. In fact, this is the only way to read internally
      formatted logs. The external format leaves it up to the user to
      read the logged deep byte lists. The disk log module cannot
      repair externally formatted logs. An item logged to an
      internally formatted log must not occupy more than 4 GB of disk
      space (the size must fit in 4 bytes).
      </p>
    <p>For each open disk log there is one process that handles requests 
      made to the disk log; the disk log process is created when <span class="code">open/1</span>
      is called, provided there exists no process handling the disk log.
      A process that opens a disk log can either be an <strong>owner</strong> 
      or an anonymous <strong>user</strong> of the disk log. Each owner is 
      linked to the disk log 
      process, and the disk log is closed by the owner should the 
      owner terminate. Owners can subscribe to <strong>notifications</strong>, 
      messages of the form <span class="code">{disk_log, Node, Log, Info}</span> that are sent
      from the disk log process when certain events occur, see 
      the commands below and in particular the <span class="code">open/1</span> option 
      <span class="bold_code"><a href="#notify">notify</a></span>. 
      There can be several owners of a log, but a process cannot own a 
      log more than once. One and the same process may, however,
      open the log 
      as a user more than once. For a disk log process to properly close 
      its file and terminate, it must be closed by its owners and once by 
      some non-owner process for each time the log was used anonymously;
      the users are counted, and there must not be any users left when the
      disk log process terminates.
      </p>
    <p>Items can be logged <strong>synchronously</strong> by using the functions
      <span class="code">log/2</span>, <span class="code">blog/2</span>, <span class="code">log_terms/2</span> and 
      <span class="code">blog_terms/2</span>. For each of these functions, the caller is put
      on hold until the items have been logged (but not necessarily 
      written, use <span class="code">sync/1</span> to ensure that). By adding an <span class="code">a</span>
      to each of the mentioned function names we get functions that log
      items <strong>asynchronously</strong>. Asynchronous functions do not wait for
      the disk log process to actually write the items to the file, but
      return the control to the caller more or less immediately.
      </p>
    <p>When using the internal format for logs, the functions
      <span class="code">log/2</span>, <span class="code">log_terms/2</span>, <span class="code">alog/2</span>, and
      <span class="code">alog_terms/2</span> should be used. These functions log one or
      more Erlang terms. By prefixing each of the functions with
      a <span class="code">b</span> (for "binary") we get the corresponding <span class="code">blog</span> 
      functions for the external format. These functions log one or 
      more deep lists of bytes or, alternatively, binaries of deep lists 
      of bytes. 
      For example, to log the string <span class="code">"hello"</span> in ASCII format, we
      can use <span class="code">disk_log:blog(Log, "hello")</span>, or
      <span class="code">disk_log:blog(Log, list_to_binary("hello"))</span>. The two
      alternatives are equally efficient. The <span class="code">blog</span> functions
      can be used for internally formatted logs as well, but in
      this case they must be called with binaries constructed with
      calls to <span class="code">term_to_binary/1</span>. There is no check to ensure
      this, it is entirely the responsibility of the caller. If these
      functions are called with binaries that do not correspond to
      Erlang terms, the <span class="code">chunk/2,3</span> and automatic repair
      functions will fail. The corresponding terms (not the binaries)
      will be returned when <span class="code">chunk/2,3</span> is called.
      </p>
    <p>A collection of open disk logs with the same name running on
      different nodes is said to be a <strong>a distributed disk log</strong>
      if requests made to any one of the logs are automatically made to
      the other logs as well. The members of such a collection will be
      called individual distributed disk logs, or just distributed
      disk logs if there is no risk of confusion. There is no order
      between the members of such a collection. For instance, logged
      terms are not necessarily written onto the node where the
      request was made before written onto the other nodes. One could
      note here that there are a few functions that do not make
      requests to all members of distributed disk logs, namely
      <span class="code">info</span>, <span class="code">chunk</span>, <span class="code">bchunk</span>, <span class="code">chunk_step</span> and
      <span class="code">lclose</span>. An open disk log that is not a distributed disk
      log is said to be a <strong>local disk log</strong>. A local disk log is
      accessible only from the node where the disk log process runs,
      whereas a distributed disk log is accessible from all nodes in
      the Erlang system, with exception for those nodes where a local
      disk log with the same name as the distributed disk log exists.
      All processes on nodes that have access to a local or
      distributed disk log can log items or otherwise change, inspect
      or close the log.
      </p>
    <p>It is not guaranteed that all log files of a distributed disk log 
      contain the same log items; there is no attempt made to synchronize
      the contents of the files. However, as long as at least one of 
      the involved nodes is alive at each time, all items will be logged. 
      When logging items to a distributed log, or otherwise trying to
      change the log, the replies from individual logs are
      ignored. If all nodes are down, the disk log functions
      reply with a <span class="code">nonode</span> error.
      </p>
    <div class="note">
<div class="label">Note</div>
<div class="content"><p>
      <p>In some applications it may not be acceptable that
        replies from individual logs are ignored. An alternative in such
        situations is to use several local disk logs instead of one
        distributed disk log, and implement the distribution without use
        of the disk log module.</p>
    </p></div>
</div>
    <p>Errors are reported differently for asynchronous log attempts
      and other uses of the disk log module. When used synchronously
      the disk log module replies with an error message, but when called
      asynchronously, the disk log module does not know where to send 
      the error message. Instead owners subscribing to notifications will 
      receive an <span class="code">error_status</span> message. 
      </p>
    <p>The disk log module itself does not report errors to the
      <span class="code">error_logger</span> module; it is up to the caller to decide
      whether the error logger should be employed or not. The function
      <span class="code">format_error/1</span> can be used to produce readable messages
      from error replies. Information events are however sent to the
      error logger in two situations, namely when a log is repaired,
      or when a file is missing while reading chunks.
      </p>
    <p>The error message <span class="code">no_such_log</span> means that the given
      disk log is not currently open. Nothing is said about 
      whether the disk log files exist or not.
      </p>
    <div class="note">
<div class="label">Note</div>
<div class="content"><p>
      <p>If an attempt to reopen or truncate a log fails (see
        <span class="code">reopen</span> and <span class="code">truncate</span>) the disk log process
        immediately terminates. Before the process terminates links to
        to owners and blocking processes (see <span class="code">block</span>) are removed.
        The effect is that the links work in one direction only; any
        process using a disk log has to check for the error message
        <span class="code">no_such_log</span> if some other process might truncate or
        reopen the log simultaneously.</p>
    </p></div>
</div>
  </p></div>
  <h3>DATA TYPES</h3>
    <p>
      <span class="bold_code"><a name="type-log">log()</a> = term()</span><br></p>
    <p>
      <span class="bold_code"><a name="type-dlog_size">dlog_size()</a> = infinity<br>            | integer() &gt;= 1<br>            | {MaxNoBytes :: integer() &gt;= 1,<br>               MaxNoFiles :: integer() &gt;= 1}</span><br></p>
    <p>
      <span class="bold_code"><a name="type-dlog_format">dlog_format()</a> = external | internal</span><br></p>
    <p>
      <span class="bold_code"><a name="type-dlog_head_opt">dlog_head_opt()</a> = none | term() | binary() | [<span class="bold_code"><a href="#type-dlog_byte">dlog_byte()</a></span>]</span><br></p>
    <p>
      <span class="bold_code"><a name="type-dlog_byte">dlog_byte()</a> = [<span class="bold_code"><a href="#type-dlog_byte">dlog_byte()</a></span>] | byte()</span><br></p>
    <p>
      <span class="bold_code"><a name="type-dlog_mode">dlog_mode()</a> = read_only | read_write</span><br></p>
    <p>
      <span class="bold_code"><a name="type-dlog_type">dlog_type()</a> = halt | wrap</span><br></p>
    <p>
      <span class="bold_code"><a name="type-continuation">continuation()</a></span><br></p>
<div class="REFBODY"><p><p>Chunk continuation returned by
         <span class="code">chunk/2,3</span>, <span class="code">bchunk/2,3</span>, or <span class="code">chunk_step/3</span>.</p>
      </p></div>
    <p>
      <span class="bold_code"><a name="type-bytes">bytes()</a> = binary() | [byte()]</span><br></p>
    <p>
      <span class="bold_code"><a name="type-invalid_header">invalid_header()</a> = term()</span><br></p>
    <p>
      <span class="bold_code"><a name="type-file_error">file_error()</a> = term()</span><br></p>
  
  <h3>EXPORTS</h3>
    <p><a name="accessible_logs-0"></a><span class="bold_code">accessible_logs() -&gt; {[LocalLog], [DistributedLog]}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">LocalLog = DistributedLog = <span class="bold_code"><a href="#type-log">log()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code"></span></div>
</div></p>
<div class="REFBODY"><p>
        <p>The <span class="code">accessible_logs/0</span> function returns
          the names of the disk logs accessible on the current node.
          The first list contains local disk logs, and the
          second list contains distributed disk logs.
          </p>
      </p></div>
    <p><a name="alog-2"></a><span class="bold_code">alog(Log, Term) -&gt; notify_ret()</span><br><a name="balog-2"></a><span class="bold_code">balog(Log, Bytes) -&gt; notify_ret()</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Log = <span class="bold_code"><a href="#type-log">log()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code">Term = term()</span></div>
<div class="REFTYPES"><span class="bold_code">Bytes = <span class="bold_code"><a href="#type-bytes">bytes()</a></span></span></div>
<div class="REFTYPES">
      <span class="bold_code">notify_ret() = ok | {error, no_such_log}</span><br>
</div>
</div></p>
<div class="REFBODY"><p>
        <p>The <span class="code">alog/2</span> and <span class="code">balog/2</span> functions asynchronously
          append an item to a disk log. The function <span class="code">alog/2</span> is 
          used for internally formatted logs, and the function <span class="code">balog/2</span>
          for externally formatted logs. <span class="code">balog/2</span> can be used
          for internally formatted logs as well provided the binary was
          constructed with a call to <span class="code">term_to_binary/1</span>.
          </p>
        <p>The owners that subscribe to notifications will receive the 
          message <span class="code">read_only</span>, <span class="code">blocked_log</span> 
          or <span class="code">format_external</span> in case the item cannot be written
          on the log, and possibly one of the messages <span class="code">wrap</span>,
          <span class="code">full</span> and <span class="code">error_status</span> if an item was written 
          on the log. The message <span class="code">error_status</span> is sent if there
          is something wrong with the header function or a file error
          occurred.
          </p>
      </p></div>
    <p><a name="alog_terms-2"></a><span class="bold_code">alog_terms(Log, TermList) -&gt; notify_ret()</span><br><a name="balog_terms-2"></a><span class="bold_code">balog_terms(Log, ByteList) -&gt; notify_ret()</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Log = <span class="bold_code"><a href="#type-log">log()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code">TermList = [term()]</span></div>
<div class="REFTYPES"><span class="bold_code">ByteList = [<span class="bold_code"><a href="#type-bytes">bytes()</a></span>]</span></div>
<div class="REFTYPES">
      <span class="bold_code">notify_ret() = ok | {error, no_such_log}</span><br>
</div>
</div></p>
<div class="REFBODY"><p>
        <p>The <span class="code">alog_terms/2</span> and <span class="code">balog_terms/2</span> functions 
          asynchronously append a list of items to a disk log. 
          The function <span class="code">alog_terms/2</span> is used for internally 
          formatted logs, and the function <span class="code">balog_terms/2</span>
          for externally formatted logs. <span class="code">balog_terms/2</span> can be used
          for internally formatted logs as well provided the binaries were
          constructed with calls to <span class="code">term_to_binary/1</span>.
          </p>
        <p>The owners that subscribe to notifications will receive the 
          message <span class="code">read_only</span>, <span class="code">blocked_log</span> 
          or <span class="code">format_external</span> in case the items cannot be written
          on the log, and possibly one or more of the messages <span class="code">wrap</span>,
          <span class="code">full</span> and <span class="code">error_status</span> if items were written 
          on the log. The message <span class="code">error_status</span> is sent if there
          is something wrong with the header function or a file error 
          occurred.
          </p>
      </p></div>
    <p><a name="block-1"></a><span class="bold_code">block(Log) -&gt; ok | {error, block_error_rsn()}</span><br><a name="block-2"></a><span class="bold_code">block(Log, QueueLogRecords) -&gt; ok | {error, block_error_rsn()}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Log = <span class="bold_code"><a href="#type-log">log()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code">QueueLogRecords = boolean()</span></div>
<div class="REFTYPES">
      <span class="bold_code">block_error_rsn() = no_such_log | nonode | {blocked_log, <span class="bold_code"><a href="#type-log">log()</a></span>}</span><br>
</div>
</div></p>
<div class="REFBODY"><p>
        <p>With a call to <span class="code">block/1,2</span> a process can block a log.
          If the blocking process is not an owner of the log, a temporary
          link is created between the disk log process and the blocking
          process. The link is used to ensure that the disk log is 
          unblocked should the blocking process terminate without 
          first closing or unblocking the log.
          </p>
        <p>Any process can probe a blocked log with <span class="code">info/1</span> or
          close it with <span class="code">close/1</span>. The blocking process can also
          use the functions <span class="code">chunk/2,3</span>, <span class="code">bchunk/2,3</span>,
          <span class="code">chunk_step/3</span>, and <span class="code">unblock/1</span> without being
          affected by the block. Any other attempt than those hitherto
          mentioned to update or read a blocked log suspends the
          calling process until the log is unblocked or returns an
          error message <span class="code">{blocked_log, Log}</span>, depending on
          whether the value of <span class="code">QueueLogRecords</span> is <span class="code">true</span>
          or <span class="code">false</span>. The default value of <span class="code">QueueLogRecords</span>
          is <span class="code">true</span>, which is used by <span class="code">block/1</span>.
          </p>
      </p></div>
    <p><a name="change_header-2"></a><span class="bold_code">change_header(Log, Header) -&gt; ok | {error, Reason}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Log = <span class="bold_code"><a href="#type-log">log()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code">Header = {head, <span class="bold_code"><a href="#type-dlog_head_opt">dlog_head_opt()</a></span>}<br>       | {head_func, MFA :: {atom(), atom(), list()}}</span></div>
<div class="REFTYPES"><span class="bold_code">Reason = no_such_log<br>       | nonode<br>       | {read_only_mode, Log}<br>       | {blocked_log, Log}<br>       | {badarg, head}</span></div>
</div></p>
<div class="REFBODY"><p>
        <p>The <span class="code">change_header/2</span> function changes the value of 
          the <span class="code">head</span> or <span class="code">head_func</span> option of a disk log.</p>
      </p></div>
    <p><a name="change_notify-3"></a><span class="bold_code">change_notify(Log, Owner, Notify) -&gt; ok | {error, Reason}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Log = <span class="bold_code"><a href="#type-log">log()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code">Owner = pid()</span></div>
<div class="REFTYPES"><span class="bold_code">Notify = boolean()</span></div>
<div class="REFTYPES"><span class="bold_code">Reason = no_such_log<br>       | nonode<br>       | {blocked_log, Log}<br>       | {badarg, notify}<br>       | {not_owner, Owner}</span></div>
</div></p>
<div class="REFBODY"><p>
        <p>The <span class="code">change_notify/3</span> function changes the value of the
          <span class="code">notify</span> option for an owner of a disk log. </p>
      </p></div>
    <p><a name="change_size-2"></a><span class="bold_code">change_size(Log, Size) -&gt; ok | {error, Reason}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Log = <span class="bold_code"><a href="#type-log">log()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code">Size = <span class="bold_code"><a href="#type-dlog_size">dlog_size()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code">Reason = no_such_log<br>       | nonode<br>       | {read_only_mode, Log}<br>       | {blocked_log, Log}<br>       | {new_size_too_small, CurrentSize :: integer() &gt;= 1}<br>       | {badarg, size}<br>       | {file_error, <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span>, <span class="bold_code"><a href="#type-file_error">file_error()</a></span>}</span></div>
</div></p>
<div class="REFBODY"><p>
        <p>The <span class="code">change_size/2</span> function changes the size of an open log. 
          For a halt log it is always possible to increase the size, 
          but it is not possible to decrease the size to something less than 
          the current size of the file.
          </p>
        <p>For a wrap log it is always possible to increase both the
          size and number of files, as long as the number of files does not 
          exceed 65000. If the maximum number of files is decreased, the
          change will not be valid until the current file is full and the 
          log wraps to the next file.
          The redundant files will be removed next time the log wraps around, 
          i.e. starts to log to file number 1.
          </p>
        <p>As an example, assume that the old maximum number of files 
          is 10 and that the new maximum number of files is 6. If 
          the current file number is not greater than the new maximum number 
          of files, the files 7 to 10 will be removed when file number 6 
          is full and the log starts to write to file number 1 again. 
          Otherwise the files greater than the current 
          file will be removed when the current file is full (e.g. if  
          the current file is 8, the files 9 and 10); the files between 
          new maximum number of files and the current 
          file (i.e. files 7 and 8) will be removed next time file number 6
          is full.
          </p>
        <p>If the size of the files is decreased the change will immediately
          affect the current log. It will not of course change the 
          size of log files already full until next time they are used.
          </p>
        <p>If the log size is decreased for instance to save space, 
          the function <span class="code">inc_wrap_file/1</span> can be used to force the log 
          to wrap.
          </p>
      </p></div>
    <p><a name="chunk-2"></a><span class="bold_code">chunk(Log, Continuation) -&gt; chunk_ret()</span><br><a name="chunk-3"></a><span class="bold_code">chunk(Log, Continuation, N) -&gt; chunk_ret()</span><br><a name="bchunk-2"></a><span class="bold_code">bchunk(Log, Continuation) -&gt; bchunk_ret()</span><br><a name="bchunk-3"></a><span class="bold_code">bchunk(Log, Continuation, N) -&gt; bchunk_ret()</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Log = <span class="bold_code"><a href="#type-log">log()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code">Continuation = start | <span class="bold_code"><a href="#type-continuation">continuation()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code">N = integer() &gt;= 1 | infinity</span></div>
<div class="REFTYPES">
      <span class="bold_code">chunk_ret() = {Continuation2 :: <span class="bold_code"><a href="#type-continuation">continuation()</a></span>,<br>               Terms :: [term()]}<br>            | {Continuation2 :: <span class="bold_code"><a href="#type-continuation">continuation()</a></span>,<br>               Terms :: [term()],<br>               Badbytes :: integer() &gt;= 0}<br>            | eof<br>            | {error, Reason :: chunk_error_rsn()}</span><br>
</div>
<div class="REFTYPES">
      <span class="bold_code">bchunk_ret() = {Continuation2 :: <span class="bold_code"><a href="#type-continuation">continuation()</a></span>,<br>                Binaries :: [binary()]}<br>             | {Continuation2 :: <span class="bold_code"><a href="#type-continuation">continuation()</a></span>,<br>                Binaries :: [binary()],<br>                Badbytes :: integer() &gt;= 0}<br>             | eof<br>             | {error, Reason :: chunk_error_rsn()}</span><br>
</div>
<div class="REFTYPES">
      <span class="bold_code">chunk_error_rsn() = no_such_log<br>                  | {format_external, <span class="bold_code"><a href="#type-log">log()</a></span>}<br>                  | {blocked_log, <span class="bold_code"><a href="#type-log">log()</a></span>}<br>                  | {badarg, continuation}<br>                  | {not_internal_wrap, <span class="bold_code"><a href="#type-log">log()</a></span>}<br>                  | {corrupt_log_file,<br>                     FileName :: <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span>}<br>                  | {file_error, <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span>, <span class="bold_code"><a href="#type-file_error">file_error()</a></span>}</span><br>
</div>
</div></p>
<div class="REFBODY"><p>
        <p>The <span class="code">chunk/2,3</span> and <span class="code">bchunk/2,3</span> functions make
          it possible to efficiently read the terms which have been
          appended to an internally formatted log. It minimizes disk
          I/O by reading 64 kilobyte chunks from the file. The
          <span class="code">bchunk/2,3</span> functions return the binaries read from
          the file; they do not call <span class="code">binary_to_term</span>. Otherwise
          the work just like <span class="code">chunk/2,3</span>.
          </p>
        <p>The first time <span class="code">chunk</span> (or <span class="code">bchunk</span>) is called,
          an initial continuation, the atom <span class="code">start</span>, must be
          provided. If there is a disk log process running on the
          current node, terms are read from that log, otherwise an
          individual distributed log on some other node is chosen, if
          such a log exists.
          </p>
        <p>When <span class="code">chunk/3</span> is called, <span class="code">N</span> controls the
          maximum number of terms that are read from the log in each
          chunk. Default is <span class="code">infinity</span>, which means that all the
          terms contained in the 64 kilobyte chunk are read. If less than
          <span class="code">N</span> terms are returned, this does not necessarily mean
          that the end of the file has been reached.
          </p>
        <p>The <span class="code">chunk</span> function returns a tuple
          <span class="code">{Continuation2, Terms}</span>, where <span class="code">Terms</span> is a list
          of terms found in the log. <span class="code">Continuation2</span> is yet
          another continuation which must be passed on to any
          subsequent calls to <span class="code">chunk</span>. With a series of calls to
          <span class="code">chunk</span> it is possible to extract all terms from a log.
          </p>
        <p>The <span class="code">chunk</span> function returns a tuple
          <span class="code">{Continuation2, Terms, Badbytes}</span> if the log is opened
          in read-only mode and the read chunk is corrupt. <span class="code">Badbytes</span>
          is the number of bytes in the file which were found not to be
          Erlang terms in the chunk. Note also that the log is not repaired.
          When trying to read chunks from a log opened in read-write mode,
          the tuple <span class="code">{corrupt_log_file, FileName}</span> is returned if the
          read chunk is corrupt.
          </p>
        <p><span class="code">chunk</span> returns <span class="code">eof</span> when the end of the log is
          reached, or <span class="code">{error, Reason}</span> if an error occurs. Should
          a wrap log file be missing, a message is output on the error log.
          </p>
        <p>When <span class="code">chunk/2,3</span> is used with wrap logs, the returned
          continuation may or may not be valid in the next call to
          <span class="code">chunk</span>. This is because the log may wrap and delete
          the file into which the continuation points. To make sure
          this does not happen, the log can be blocked during the
          search.
          </p>
      </p></div>
    <p><a name="chunk_info-1"></a><span class="bold_code">chunk_info(Continuation) -&gt; InfoList | {error, Reason}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Continuation = <span class="bold_code"><a href="#type-continuation">continuation()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code">InfoList = [{node, Node :: node()}, ...]</span></div>
<div class="REFTYPES"><span class="bold_code">Reason = {no_continuation, Continuation}</span></div>
</div></p>
<div class="REFBODY"><p>
        <p>The <span class="code">chunk_info/1</span> function returns the following pair
          describing the chunk continuation returned by
          <span class="code">chunk/2,3</span>, <span class="code">bchunk/2,3</span>, or <span class="code">chunk_step/3</span>:
          </p>
        <ul>
          <li>
            <p><span class="code">{node, Node}</span>. Terms are read from
              the disk log running on <span class="code">Node</span>.</p>
          </li>
        </ul>
      </p></div>
    <p><a name="chunk_step-3"></a><span class="bold_code">chunk_step(Log, Continuation, Step) -&gt;<br>              {ok, any()} | {error, Reason}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Log = <span class="bold_code"><a href="#type-log">log()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code">Continuation = start | <span class="bold_code"><a href="#type-continuation">continuation()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code">Step = integer()</span></div>
<div class="REFTYPES"><span class="bold_code">Reason = no_such_log<br>       | end_of_log<br>       | {format_external, Log}<br>       | {blocked_log, Log}<br>       | {badarg, continuation}<br>       | {file_error, <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span>, <span class="bold_code"><a href="#type-file_error">file_error()</a></span>}</span></div>
</div></p>
<div class="REFBODY"><p>
        <p>The function <span class="code">chunk_step</span> can be used in conjunction
          with <span class="code">chunk/2,3</span> and <span class="code">bchunk/2,3</span> to search
          through an internally formatted wrap log. It takes as
          argument a continuation as returned by <span class="code">chunk/2,3</span>,
          <span class="code">bchunk/2,3</span>, or <span class="code">chunk_step/3</span>, and steps forward
          (or backward) <span class="code">Step</span> files in the wrap log. The
          continuation returned points to the first log item in the
          new current file.
          </p>
        <p>If the atom <span class="code">start</span> is given as continuation, a disk log
          to read terms from is chosen. A local or distributed disk log
          on the current node is preferred to an
          individual distributed log on some other node.
          </p>
        <p>If the wrap log is not full because all files have not been
          used yet, <span class="code">{error, end_of_log}</span> is returned if trying to
          step outside the log.
          </p>
      </p></div>
    <p><a name="close-1"></a><span class="bold_code">close(Log) -&gt; ok | {error, close_error_rsn()}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Log = <span class="bold_code"><a href="#type-log">log()</a></span></span></div>
<div class="REFTYPES">
      <span class="bold_code">close_error_rsn() = no_such_log<br>                  | nonode<br>                  | {file_error, <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span>, <span class="bold_code"><a href="#type-file_error">file_error()</a></span>}</span><br>
</div>
</div></p>
<div class="REFBODY"><p>
        <p><a name="close_1"></a>The function <span class="code">close/1</span> closes a
          local or distributed disk log properly. An internally
          formatted log must be closed before the Erlang system is
          stopped, otherwise the log is regarded as unclosed and the
          automatic repair procedure will be activated next time the
          log is opened.
          </p>
        <p>The disk log process in not terminated as long as there are
          owners or users of the log. It should be stressed that each
          and every owner must close the log, possibly by terminating,
          and that any other process - not only the processes that have 
          opened the log anonymously - can decrement the <span class="code">users</span>
          counter by closing the log. 
          Attempts to close a log by a process that is 
          not an owner are simply ignored if there are no users.
          </p>
        <p>If the log is blocked by the closing process, the log is also
          unblocked.
          </p>
      </p></div>
    <p><a name="format_error-1"></a><span class="bold_code">format_error(Error) -&gt; <span class="bold_code"><a href="javascript:erlhref('../../../../doc/../','stdlib','io_lib.html#type-chars');">io_lib:chars()</a></span></span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Error = term()</span></div>
</div></p>
<div class="REFBODY"><p>
        <p>Given the error returned by any function in this module, 
          the function <span class="code">format_error</span> returns a descriptive string
          of the error in English. For file errors, the function 
          <span class="code">format_error/1</span> in the <span class="code">file</span> module is called.</p>
      </p></div>
    <p><a name="inc_wrap_file-1"></a><span class="bold_code">inc_wrap_file(Log) -&gt; ok | {error, inc_wrap_error_rsn()}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Log = <span class="bold_code"><a href="#type-log">log()</a></span></span></div>
<div class="REFTYPES">
      <span class="bold_code">inc_wrap_error_rsn() = no_such_log<br>                     | nonode<br>                     | {read_only_mode, <span class="bold_code"><a href="#type-log">log()</a></span>}<br>                     | {blocked_log, <span class="bold_code"><a href="#type-log">log()</a></span>}<br>                     | {halt_log, <span class="bold_code"><a href="#type-log">log()</a></span>}<br>                     | {invalid_header, <span class="bold_code"><a href="#type-invalid_header">invalid_header()</a></span>}<br>                     | {file_error,<br>                        <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span>,<br>                        <span class="bold_code"><a href="#type-file_error">file_error()</a></span>}</span><br>
</div>
<div class="REFTYPES">
      <span class="bold_code">invalid_header() = term()</span><br>
</div>
</div></p>
<div class="REFBODY"><p>
        <p>The <span class="code">inc_wrap_file/1</span> function forces the internally formatted 
          disk log to start logging to the 
          next log file. It can be used, for instance, in conjunction with
          <span class="code">change_size/2</span> to reduce the amount of disk space allocated
          by the disk log.
          </p>
        <p>The owners that subscribe to notifications will normally 
          receive a <span class="code">wrap</span> message, but in case of 
          an error with a reason tag of <span class="code">invalid_header</span> or 
          <span class="code">file_error</span> an <span class="code">error_status</span> message will be sent.</p>
      </p></div>
    <p><a name="info-1"></a><span class="bold_code">info(Log) -&gt; InfoList | {error, no_such_log}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Log = <span class="bold_code"><a href="#type-log">log()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code">InfoList = [dlog_info()]</span></div>
<div class="REFTYPES">
      <span class="bold_code">dlog_info() = {name, Log :: <span class="bold_code"><a href="#type-log">log()</a></span>}<br>            | {file, File :: <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span>}<br>            | {type, Type :: <span class="bold_code"><a href="#type-dlog_type">dlog_type()</a></span>}<br>            | {format, Format :: <span class="bold_code"><a href="#type-dlog_format">dlog_format()</a></span>}<br>            | {size, Size :: <span class="bold_code"><a href="#type-dlog_size">dlog_size()</a></span>}<br>            | {mode, Mode :: <span class="bold_code"><a href="#type-dlog_mode">dlog_mode()</a></span>}<br>            | {owners, [{pid(), Notify :: boolean()}]}<br>            | {users, Users :: integer() &gt;= 0}<br>            | {status,<br>               Status :: ok<br>                       | {blocked,<br>                          QueueLogRecords :: boolean()}}<br>            | {node, Node :: node()}<br>            | {distributed, Dist :: local | [node()]}<br>            | {head,<br>               Head :: none<br>                     | {head, term()}<br>                     | (MFA :: {atom(), atom(), list()})}<br>            | {no_written_items,<br>               NoWrittenItems :: integer() &gt;= 0}<br>            | {full, Full :: boolean}<br>            | {no_current_bytes, integer() &gt;= 0}<br>            | {no_current_items, integer() &gt;= 0}<br>            | {no_items, integer() &gt;= 0}<br>            | {current_file, integer() &gt;= 1}<br>            | {no_overflows,<br>               {SinceLogWasOpened :: integer() &gt;= 0,<br>                SinceLastInfo :: integer() &gt;= 0}}</span><br>
</div>
</div></p>
<div class="REFBODY"><p>
        <p>The <span class="code">info/1</span> function returns a list of <span class="code">{Tag, Value}</span> 
          pairs describing the log. If there is a disk log process running
          on the current node, that log is used as source of information,
          otherwise an individual distributed log on
          some other node is chosen, if such a log exists.
          </p>
        <p>The following pairs are returned for all logs:
          </p>
        <ul>
          <li>
            <p><span class="code">{name, Log}</span>, where <span class="code">Log</span> is the name of
              the log as given by the <span class="code">open/1</span> option <span class="code">name</span>.</p>
          </li>
          <li>
            <p><span class="code">{file, File}</span>. For halt logs <span class="code">File</span> is the
              filename, and for wrap logs <span class="code">File</span> is the base name.</p>
          </li>
          <li>
            <p><span class="code">{type, Type}</span>, where <span class="code">Type</span> is the type of
              the log as given by the <span class="code">open/1</span> option <span class="code">type</span>.</p>
          </li>
          <li>
            <p><span class="code">{format, Format}</span>, where <span class="code">Format</span> is the format
              of the log as given by the <span class="code">open/1</span> option <span class="code">format</span>.</p>
          </li>
          <li>
            <p><span class="code">{size, Size}</span>, where <span class="code">Size</span> is the size
              of the log as given by the <span class="code">open/1</span> option <span class="code">size</span>,
              or the size set by <span class="code">change_size/2</span>. The value set by 
              <span class="code">change_size/2</span> is reflected immediately.</p>
          </li>
          <li>
            <p><span class="code">{mode, Mode}</span>, where <span class="code">Mode</span> is the mode
              of the log as given by the <span class="code">open/1</span> option <span class="code">mode</span>.</p>
          </li>
          <li>
            <p><span class="code">{owners, [{pid(), Notify}]}</span> where <span class="code">Notify</span>
              is the value set by the <span class="code">open/1</span> option <span class="code">notify</span>
              or the function <span class="code">change_notify/3</span> for the owners of 
              the log.</p>
          </li>
          <li>
            <p><span class="code">{users, Users}</span> where <span class="code">Users</span> is the number
              of anonymous users of the log, see the <span class="code">open/1</span> option
              <span class="bold_code"><a href="#linkto">linkto</a></span>.</p>
          </li>
          <li>
            <p><span class="code">{status, Status}</span>, where <span class="code">Status</span> is <span class="code">ok</span>
              or <span class="code">{blocked, QueueLogRecords}</span> as set by the functions
              <span class="code">block/1,2</span> and <span class="code">unblock/1</span>.</p>
          </li>
          <li>
            <p><span class="code">{node, Node}</span>. The information returned by the
              current invocation of the <span class="code">info/1</span> function has been
              gathered from the disk log process running on <span class="code">Node</span>.</p>
          </li>
          <li>
            <p><span class="code">{distributed, Dist}</span>. If the log is local on
              the current node, then <span class="code">Dist</span> has the value <span class="code">local</span>,
              otherwise all nodes where the log is distributed
              are returned as a list.</p>
          </li>
        </ul>
        <p>The following pairs are returned for all logs opened in 
          <span class="code">read_write</span> mode:
          </p>
        <ul>
          <li>
            <p><span class="code">{head, Head}</span>. Depending of the value of
              the <span class="code">open/1</span> options <span class="code">head</span> and <span class="code">head_func</span>
              or set by the function <span class="code">change_header/2</span>, the value
              of <span class="code">Head</span> is <span class="code">none</span> (default),
              <span class="code">{head, H}</span> (<span class="code">head</span> option) or <span class="code">{M,F,A}</span> 
              (<span class="code">head_func</span> option).</p>
          </li>
          <li>
            <p><span class="code">{no_written_items, NoWrittenItems}</span>, where
              <span class="code">NoWrittenItems</span> is the number of items
              written to the log since the disk log process was created.</p>
          </li>
        </ul>
        <p>The following pair is returned for halt logs opened in 
          <span class="code">read_write</span> mode:
          </p>
        <ul>
          <li>
            <p><span class="code">{full, Full}</span>, where <span class="code">Full</span> is <span class="code">true</span> or
              <span class="code">false</span> depending on whether the halt log is full or not.</p>
          </li>
        </ul>
        <p>The following pairs are returned for wrap logs opened in 
          <span class="code">read_write</span> mode:
          </p>
        <ul>
          <li>
            <p><span class="code">{no_current_bytes, integer() &gt;= 0}</span> is the number
              of bytes written to the current wrap log file.</p>
          </li>
          <li>
            <p><span class="code">{no_current_items, integer() &gt;= 0}</span> is the number
              of items written to the current wrap log file, header
              inclusive.</p>
          </li>
          <li>
            <p><span class="code">{no_items, integer() &gt;= 0}</span> is the total number
              of items in all wrap log files.</p>
          </li>
          <li>
            <p><span class="code">{current_file, integer()}</span> is the ordinal for
              the current wrap log file in the range <span class="code">1..MaxNoFiles</span>,
              where <span class="code">MaxNoFiles</span> is given by the <span class="code">open/1</span> option
              <span class="code">size</span> or set by <span class="code">change_size/2</span>.</p>
          </li>
          <li>
            <p><span class="code">{no_overflows, {SinceLogWasOpened, SinceLastInfo}}</span>,
              where <span class="code">SinceLogWasOpened</span> (<span class="code">SinceLastInfo</span>) is
              the number of times a wrap log file has been filled up and a 
              new one opened or <span class="code">inc_wrap_file/1</span> has been called since 
              the disk log was last opened (<span class="code">info/1</span> 
              was last called). The first time <span class="code">info/2</span> is called 
              after a log was (re)opened or truncated, the two values 
              are equal.</p>
          </li>
        </ul>
        <p>Note that the <span class="code">chunk/2,3</span>, <span class="code">bchunk/2,3</span>, and
          <span class="code">chunk_step/3</span> functions do not affect any value
          returned by <span class="code">info/1</span>.
          </p>
      </p></div>
    <p><a name="lclose-1"></a><span class="bold_code">lclose(Log) -&gt; ok | {error, lclose_error_rsn()}</span><br><a name="lclose-2"></a><span class="bold_code">lclose(Log, Node) -&gt; ok | {error, lclose_error_rsn()}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Log = <span class="bold_code"><a href="#type-log">log()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code">Node = node()</span></div>
<div class="REFTYPES">
      <span class="bold_code">lclose_error_rsn() = no_such_log<br>                   | {file_error,<br>                      <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span>,<br>                      <span class="bold_code"><a href="#type-file_error">file_error()</a></span>}</span><br>
</div>
</div></p>
<div class="REFBODY"><p>
        <p>The function <span class="code">lclose/1</span> closes a local log or an
          individual distributed log on the current node.
          The function <span class="code">lclose/2</span> closes an individual
          distributed log on the specified node if the node
          is not the current one.
          <span class="code">lclose(Log)</span> is equivalent to
          <span class="code">lclose(Log, node())</span>.
          See also <span class="bold_code"><a href="#close_1">close/1</a></span>.
          </p>
        <p>If there is no log with the given name
          on the specified node, <span class="code">no_such_log</span> is returned. 
          </p>
      </p></div>
    <p><a name="log-2"></a><span class="bold_code">log(Log, Term) -&gt; ok | {error, Reason :: log_error_rsn()}</span><br><a name="blog-2"></a><span class="bold_code">blog(Log, Bytes) -&gt; ok | {error, Reason :: log_error_rsn()}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Log = <span class="bold_code"><a href="#type-log">log()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code">Term = term()</span></div>
<div class="REFTYPES"><span class="bold_code">Bytes = <span class="bold_code"><a href="#type-bytes">bytes()</a></span></span></div>
<div class="REFTYPES">
      <span class="bold_code">log_error_rsn() = no_such_log<br>                | nonode<br>                | {read_only_mode, <span class="bold_code"><a href="#type-log">log()</a></span>}<br>                | {format_external, <span class="bold_code"><a href="#type-log">log()</a></span>}<br>                | {blocked_log, <span class="bold_code"><a href="#type-log">log()</a></span>}<br>                | {full, <span class="bold_code"><a href="#type-log">log()</a></span>}<br>                | {invalid_header, <span class="bold_code"><a href="#type-invalid_header">invalid_header()</a></span>}<br>                | {file_error, <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span>, <span class="bold_code"><a href="#type-file_error">file_error()</a></span>}</span><br>
</div>
</div></p>
<div class="REFBODY"><p>
        <p>The <span class="code">log/2</span> and <span class="code">blog/2</span> functions synchronously
          append a term to a disk log. They return <span class="code">ok</span> or
          <span class="code">{error, Reason}</span> when the term has been written to
          disk. If the log is distributed, <span class="code">ok</span> is always
          returned, unless all nodes are down. Terms are written by
          means of the ordinary <span class="code">write()</span> function of the
          operating system. Hence, there is no guarantee that the term
          has actually been written to the disk, it might linger in
          the operating system kernel for a while. To make sure the
          item is actually written to disk, the <span class="code">sync/1</span> function
          must be called.
          </p>
        <p>The <span class="code">log/2</span> function is used for internally formatted logs,
          and <span class="code">blog/2</span> for externally formatted logs. 
          <span class="code">blog/2</span> can be used
          for internally formatted logs as well provided the binary was
          constructed with a call to <span class="code">term_to_binary/1</span>.
          </p>
        <p>The owners that subscribe to notifications will be notified 
          of an error with an <span class="code">error_status</span> message if the error 
          reason tag is <span class="code">invalid_header</span> or <span class="code">file_error</span>.
          </p>
      </p></div>
    <p><a name="log_terms-2"></a><span class="bold_code">log_terms(Log, TermList) -&gt;<br>             ok | {error, Resaon :: log_error_rsn()}</span><br><a name="blog_terms-2"></a><span class="bold_code">blog_terms(Log, BytesList) -&gt;<br>              ok | {error, Reason :: log_error_rsn()}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Log = <span class="bold_code"><a href="#type-log">log()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code">TermList = [term()]</span></div>
<div class="REFTYPES"><span class="bold_code">BytesList = [<span class="bold_code"><a href="#type-bytes">bytes()</a></span>]</span></div>
<div class="REFTYPES">
      <span class="bold_code">log_error_rsn() = no_such_log<br>                | nonode<br>                | {read_only_mode, <span class="bold_code"><a href="#type-log">log()</a></span>}<br>                | {format_external, <span class="bold_code"><a href="#type-log">log()</a></span>}<br>                | {blocked_log, <span class="bold_code"><a href="#type-log">log()</a></span>}<br>                | {full, <span class="bold_code"><a href="#type-log">log()</a></span>}<br>                | {invalid_header, <span class="bold_code"><a href="#type-invalid_header">invalid_header()</a></span>}<br>                | {file_error, <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span>, <span class="bold_code"><a href="#type-file_error">file_error()</a></span>}</span><br>
</div>
</div></p>
<div class="REFBODY"><p>
        <p>The <span class="code">log_terms/2</span> and <span class="code">blog_terms/2</span> functions
          synchronously append a list of items to the log. The benefit
          of using these functions rather than the <span class="code">log/2</span> and
          <span class="code">blog/2</span> functions is that of efficiency: the given
          list is split into as large sublists as possible (limited by
          the size of wrap log files), and each sublist is logged as
          one single item, which reduces the overhead.
          </p>
        <p>The <span class="code">log_terms/2</span> function is used for internally formatted
          logs, and <span class="code">blog_terms/2</span> for externally formatted logs.
          <span class="code">blog_terms/2</span> can be used
          for internally formatted logs as well provided the binaries were
          constructed with calls to <span class="code">term_to_binary/1</span>.
          </p>
        <p>The owners that subscribe to notifications will be notified 
          of an error with an <span class="code">error_status</span> message if the error 
          reason tag is <span class="code">invalid_header</span> or <span class="code">file_error</span>.
          </p>
      </p></div>
    <p><a name="open-1"></a><span class="bold_code">open(ArgL) -&gt; open_ret() | dist_open_ret()</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">ArgL = dlog_options()</span></div>
<div class="REFTYPES">
      <span class="bold_code">dlog_options() = [dlog_option()]</span><br>
</div>
<div class="REFTYPES">
      <span class="bold_code">dlog_option() = {name, Log :: <span class="bold_code"><a href="#type-log">log()</a></span>}<br>              | {file, FileName :: <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span>}<br>              | {linkto, LinkTo :: none | pid()}<br>              | {repair, Repair :: true | false | truncate}<br>              | {type, Type :: dlog_type}<br>              | {format, Format :: <span class="bold_code"><a href="#type-dlog_format">dlog_format()</a></span>}<br>              | {size, Size :: <span class="bold_code"><a href="#type-dlog_size">dlog_size()</a></span>}<br>              | {distributed, Nodes :: [node()]}<br>              | {notify, boolean()}<br>              | {head, Head :: <span class="bold_code"><a href="#type-dlog_head_opt">dlog_head_opt()</a></span>}<br>              | {head_func, MFA :: {atom(), atom(), list()}}<br>              | {mode, Mode :: <span class="bold_code"><a href="#type-dlog_mode">dlog_mode()</a></span>}</span><br>
</div>
<div class="REFTYPES">
      <span class="bold_code">open_ret() = ret() | {error, open_error_rsn()}</span><br>
</div>
<div class="REFTYPES">
      <span class="bold_code">ret() = {ok, Log :: <span class="bold_code"><a href="#type-log">log()</a></span>}<br>      | {repaired,<br>         Log :: <span class="bold_code"><a href="#type-log">log()</a></span>,<br>         {recovered, Rec :: integer() &gt;= 0},<br>         {badbytes, Bad :: integer() &gt;= 0}}</span><br>
</div>
<div class="REFTYPES">
      <span class="bold_code">dist_open_ret() = <br>    {[{node(), ret()}], [{node(), {error, dist_error_rsn()}}]}</span><br>
</div>
<div class="REFTYPES">
      <span class="bold_code">dist_error_rsn() = nodedown | open_error_rsn()</span><br>
</div>
<div class="REFTYPES">
      <span class="bold_code">open_error_rsn() = no_such_log<br>                 | {badarg, term()}<br>                 | {size_mismatch,<br>                    CurrentSize :: <span class="bold_code"><a href="#type-dlog_size">dlog_size()</a></span>,<br>                    NewSize :: <span class="bold_code"><a href="#type-dlog_size">dlog_size()</a></span>}<br>                 | {arg_mismatch,<br>                    OptionName :: dlog_optattr(),<br>                    CurrentValue :: term(),<br>                    Value :: term()}<br>                 | {name_already_open, Log :: <span class="bold_code"><a href="#type-log">log()</a></span>}<br>                 | {open_read_write, Log :: <span class="bold_code"><a href="#type-log">log()</a></span>}<br>                 | {open_read_only, Log :: <span class="bold_code"><a href="#type-log">log()</a></span>}<br>                 | {need_repair, Log :: <span class="bold_code"><a href="#type-log">log()</a></span>}<br>                 | {not_a_log_file,<br>                    FileName :: <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span>}<br>                 | {invalid_index_file,<br>                    FileName :: <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span>}<br>                 | {invalid_header, <span class="bold_code"><a href="#type-invalid_header">invalid_header()</a></span>}<br>                 | {file_error, <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span>, <span class="bold_code"><a href="#type-file_error">file_error()</a></span>}<br>                 | {node_already_open, Log :: <span class="bold_code"><a href="#type-log">log()</a></span>}</span><br>
</div>
<div class="REFTYPES">
      <span class="bold_code">dlog_optattr() = name<br>               | file<br>               | linkto<br>               | repair<br>               | type<br>               | format<br>               | size<br>               | distributed<br>               | notify<br>               | head<br>               | head_func<br>               | mode</span><br>
</div>
<div class="REFTYPES">
      <span class="bold_code">dlog_size() = infinity<br>            | integer() &gt;= 1<br>            | {MaxNoBytes :: integer() &gt;= 1,<br>               MaxNoFiles :: integer() &gt;= 1}</span><br>
</div>
</div></p>
<div class="REFBODY"><p>
        <p>The <span class="code">ArgL</span> parameter is a list of options which have
          the following meanings:</p>
        <ul>
          <li>
            <p><span class="code">{name, Log}</span> 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.
              </p>
          </li>
          <li>
            <p><span class="code">{file, FileName}</span> 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 <span class="code">lists:concat([Log, ".LOG"])</span> for halt logs. For wrap logs, this will be
              the base name of the files. Each file in a wrap log
              will be called <span class="code">&lt;base_name&gt;.N</span>, where <span class="code">N</span> is an
              integer. Each wrap log will also have two files called
              <span class="code">&lt;base_name&gt;.idx</span> and <span class="code">&lt;base_name&gt;.siz</span>.
              </p>
          </li>
          <li>
            <p><span class="code">{linkto, LinkTo}</span>.               <a name="linkto"></a>
If
              <span class="code">LinkTo</span> is a pid, that pid becomes an owner of the
              log. If <span class="code">LinkTo</span> is <span class="code">none</span> the log records
              that it is used anonymously by some process by
              incrementing the <span class="code">users</span> counter. By default, the
              process which calls <span class="code">open/1</span> owns the log.
              </p>
          </li>
          <li>
            <p><span class="code">{repair, Repair}</span>. If <span class="code">Repair</span> is <span class="code">true</span>,
              the current log file will be repaired, if needed. As the
              restoration is initiated, a message is output on the error log.
              If <span class="code">false</span> is given,
              no automatic repair will be attempted. Instead, the
              tuple <span class="code">{error, {need_repair, Log}}</span> is returned if an
              attempt is made to open a corrupt log file. 
              If <span class="code">truncate</span> is given, the log file will
              be truncated, creating an empty log. Default is 
              <span class="code">true</span>, which has no effect on logs opened in 
              read-only mode.
              </p>
          </li>
          <li>
            <p><span class="code">{type, Type}</span> is the type of the log. Default
              is <span class="code">halt</span>.
              </p>
          </li>
          <li>
            <p><span class="code">{format, Format}</span> specifies the format of the
              disk log. Default is <span class="code">internal</span>. 
              </p>
          </li>
          <li>
            <p><span class="code">{size, Size}</span> 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 
              <span class="code">infinity</span>, which for halt implies that there is no
              maximum size. For wrap logs, the <span class="code">Size</span> parameter
              may be either a pair
              <span class="code">{MaxNoBytes, MaxNoFiles}</span> or <span class="code">infinity</span>. 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 <span class="code">MaxNoBytes</span> bytes on each file
              and use <span class="code">MaxNoFiles</span> files before starting all over with
              the first wrap log file. Regardless of <span class="code">MaxNoBytes</span>,
              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 <span class="code">Size</span>, but any
              supplied value must equal the current size of the log, otherwise
              the tuple <span class="code">{error, {size_mismatch, CurrentSize, NewSize}}</span>
              is returned.
              </p>
          </li>
          <li>
            <p><span class="code">{distributed, Nodes}</span>. This option can be used for
              adding members to a distributed disk log. The
              default value is <span class="code">[]</span>, which means that
              the log is local on the current node.
              </p>
          </li>
          <li>
            <a name="notify"></a>
            <p><span class="code">{notify, bool()}</span>. If <span class="code">true</span>, the owners of the
              log are notified when certain events occur in the log.
              Default is <span class="code">false</span>. The owners are sent one of the
              following messages when an event occurs:
              </p>
            <ul>
              <li>
                <p><span class="code">{disk_log, Node, Log, {wrap, NoLostItems}}</span> is sent when a wrap log has
                  filled up one of its files and a new file is
                  opened. <span class="code">NoLostItems</span> is the number of
                  previously logged items that have been lost when
                  truncating existing files.
                  </p>
              </li>
              <li>
                <p><span class="code">{disk_log, Node, Log, {truncated, NoLostItems}}</span> is sent when a log has been
                  truncated or reopened. For halt logs <span class="code">NoLostItems</span>
                  is the number of items written on the log since the 
                  disk log process was created. For wrap logs 
                  <span class="code">NoLostItems</span> is the number of items on all 
                  wrap log files.
                  </p>
              </li>
              <li>
                <p><span class="code">{disk_log, Node, Log, {read_only, Items}}</span> 
                  is sent when an asynchronous log attempt is made to 
                  a log file opened in read-only mode. 
                  <span class="code">Items</span> is the items from the log attempt.
                  </p>
              </li>
              <li>
                <p><span class="code">{disk_log, Node, Log, {blocked_log, Items}}</span> 
                  is sent when an asynchronous log attempt is made to
                  a blocked log that does not queue log attempts.
                  <span class="code">Items</span> is the items from the log attempt.
                  </p>
              </li>
              <li>
                <p><span class="code">{disk_log, Node, Log, {format_external, Items}}</span> 
                  is sent when <span class="code">alog/2</span> or <span class="code">alog_terms/2</span> is 
                  used for internally formatted logs. <span class="code">Items</span> is the 
                  items from the log attempt.
                  </p>
              </li>
              <li>
                <p><span class="code">{disk_log, Node, Log, full}</span> is sent when
                  an attempt to log items to a wrap log would write more
                  bytes than the limit set by the <span class="code">size</span> option.
                  </p>
              </li>
              <li>
                <p><span class="code">{disk_log, Node, Log, {error_status, Status}}</span> 
                  is sent when the error status changes. The error status
                  is defined by the outcome of the last attempt to log
                  items to a the log or to truncate the log or the last
                  use of <span class="code">sync/1</span>, <span class="code">inc_wrap_file/1</span> or
                  <span class="code">change_size/2</span>. <span class="code">Status</span> is one of <span class="code">ok</span> and
                  <span class="code">{error, Error}</span>, the former being the initial value.
                  </p>
              </li>
            </ul>
          </li>
          <li>
            <p><span class="code">{head, Head}</span> specifies a header to be
              written first on the log file. If the log is a wrap
              log, the item <span class="code">Head</span> is written first in each new file.
              <span class="code">Head</span> should be a term if the format is
              <span class="code">internal</span>, and a deep list of bytes (or a binary)
              otherwise. Default is <span class="code">none</span>, which means that
              no header is written first on the file.
              </p>
          </li>
          <li>
            <p><span class="code">{head_func, {M,F,A}}</span> specifies a function
              to be called each time a new log file is opened.
              The call <span class="code">M:F(A)</span> is assumed to return <span class="code">{ok, Head}</span>.
              The item <span class="code">Head</span> is written first in each file.
              <span class="code">Head</span> should be a term if the format is
              <span class="code">internal</span>, and a deep list of bytes (or a binary)
              otherwise.
              </p>
          </li>
          <li>
            <p><span class="code">{mode, Mode}</span> specifies if the log is to be
              opened in read-only or read-write mode. It defaults to
              <span class="code">read_write</span>.
              </p>
          </li>
        </ul>
        <p>The <span class="code">open/1</span> function returns <span class="code">{ok, Log}</span> if the
          log file was successfully opened. If the file was
          successfully repaired, the tuple <span class="code">{repaired, Log, {recovered, Rec}, {badbytes, Bad}}</span> is returned, where
          <span class="code">Rec</span> is the number of whole Erlang terms found in the
          file and <span class="code">Bad</span> is the number of bytes in the file which
          were non-Erlang terms. If the <span class="code">distributed</span> parameter
          was given, <span class="code">open/1</span> returns a list of
          successful replies and a list of erroneous replies. Each
          reply is tagged with the node name.
          </p>
        <p>When a disk log is opened in read-write mode, any existing
          log file is checked for. If there is none a new empty
          log is created, otherwise the existing file is opened at the
          position after the last logged item, and the logging of items
          will commence from there. If the format is <span class="code">internal</span>
          and the existing file is not recognized as an internally
          formatted log, a tuple <span class="code">{error, {not_a_log_file, FileName}}</span>
          is returned.
          </p>
        <p>The <span class="code">open/1</span> function cannot be used for changing the
          values of options of an already open log; when there are prior
          owners or users of a log, all option values except <span class="code">name</span>, 
          <span class="code">linkto</span> and <span class="code">notify</span> are just checked against 
          the values that have been supplied before as option values
          to <span class="code">open/1</span>, <span class="code">change_header/2</span>, <span class="code">change_notify/3</span>
          or <span class="code">change_size/2</span>. As a consequence,
          none of the options except <span class="code">name</span> is mandatory. If some
          given value differs from the current value, a tuple
          <span class="code">{error, {arg_mismatch, OptionName, CurrentValue, Value}}</span>
          is returned. Caution: an owner's attempt to open a log 
          as owner once again is acknowledged with the return value 
          <span class="code">{ok, Log}</span>, but the state of the disk log is not
          affected in any way.
          </p>
        <p>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 <span class="code">{error, {node_already_open, Log}}</span> 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
          adds those logs to a (possibly empty) distributed disk log.
          The option values supplied are used 
          on all nodes mentioned by the <span class="code">distributed</span> option. 
          Individual distributed logs know nothing
          about each other's option values, so each node can be
          given unique option values by creating a distributed
          log with several calls to <span class="code">open/1</span>.
          </p>
        <p>It is possible to open a log file more than once by giving
          different values to the option <span class="code">name</span> or by using the
          same file when distributing a log on different nodes.
          It is up to the user of the <span class="code">disk_log</span>
          module to ensure that no more than one
          disk log process has write access to any file, or the 
          the file may be corrupted.
          </p>
        <p>If an attempt to open a log file for the first time fails, 
          the disk log process terminates with the EXIT message 
          <span class="code">{{failed,Reason},[{disk_log,open,1}]}</span>.
          The function returns <span class="code">{error, Reason}</span> for all other errors.
          </p>
      </p></div>
    <p><a name="pid2name-1"></a><span class="bold_code">pid2name(Pid) -&gt; {ok, Log} | undefined</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Pid = pid()</span></div>
<div class="REFTYPES"><span class="bold_code">Log = <span class="bold_code"><a href="#type-log">log()</a></span></span></div>
</div></p>
<div class="REFBODY"><p>
        <p>The <span class="code">pid2name/1</span> function returns the name of the log
          given the pid of a disk log process on the current node, or
          <span class="code">undefined</span> if the given pid is not a disk log process.
          </p>
        <p>This function is meant to be used for debugging only.
          </p>
      </p></div>
    <p><a name="reopen-2"></a><span class="bold_code">reopen(Log, File) -&gt; ok | {error, reopen_error_rsn()}</span><br><a name="reopen-3"></a><span class="bold_code">reopen(Log, File, Head) -&gt; ok | {error, reopen_error_rsn()}</span><br><a name="breopen-3"></a><span class="bold_code">breopen(Log, File, BHead) -&gt; ok | {error, reopen_error_rsn()}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Log = <span class="bold_code"><a href="#type-log">log()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code">File = <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code">Head = term()</span></div>
<div class="REFTYPES"><span class="bold_code">BHead = <span class="bold_code"><a href="#type-bytes">bytes()</a></span></span></div>
<div class="REFTYPES">
      <span class="bold_code">reopen_error_rsn() = no_such_log<br>                   | nonode<br>                   | {read_only_mode, <span class="bold_code"><a href="#type-log">log()</a></span>}<br>                   | {blocked_log, <span class="bold_code"><a href="#type-log">log()</a></span>}<br>                   | {same_file_name, <span class="bold_code"><a href="#type-log">log()</a></span>}<br>                   | {invalid_index_file, <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span>}<br>                   | {invalid_header, <span class="bold_code"><a href="#type-invalid_header">invalid_header()</a></span>}<br>                   | {file_error,<br>                      <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span>,<br>                      <span class="bold_code"><a href="#type-file_error">file_error()</a></span>}</span><br>
</div>
</div></p>
<div class="REFBODY"><p>
        <p>The <span class="code">reopen</span> functions first rename the log file 
          to <span class="code">File</span> and then re-create a new log file.
          In case of a wrap log, <span class="code">File</span> is used as the base name
          of the renamed files.
          By default the header given to <span class="code">open/1</span> is written first in
          the newly opened log file, but if the <span class="code">Head</span> or the
          <span class="code">BHead</span> argument is given, this item is used instead.
          The header argument is used once only; next time a wrap log file
          is opened, the header given to <span class="code">open/1</span> is used.
          </p>
        <p>The <span class="code">reopen/2,3</span> functions are used for internally formatted 
          logs, and <span class="code">breopen/3</span> for externally formatted logs.
          </p>
        <p>The owners that subscribe to notifications will receive 
          a <span class="code">truncate</span> message.
          </p>
        <p>Upon failure to reopen the log, the disk log process terminates
          with the EXIT message <span class="code">{{failed,Error},[{disk_log,Fun,Arity}]}</span>,
          and other processes that have requests queued receive the message 
          <span class="code">{disk_log, Node, {error, disk_log_stopped}}</span>.
          </p>
      </p></div>
    <p><a name="sync-1"></a><span class="bold_code">sync(Log) -&gt; ok | {error, sync_error_rsn()}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Log = <span class="bold_code"><a href="#type-log">log()</a></span></span></div>
<div class="REFTYPES">
      <span class="bold_code">sync_error_rsn() = no_such_log<br>                 | nonode<br>                 | {read_only_mode, <span class="bold_code"><a href="#type-log">log()</a></span>}<br>                 | {blocked_log, <span class="bold_code"><a href="#type-log">log()</a></span>}<br>                 | {file_error, <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span>, <span class="bold_code"><a href="#type-file_error">file_error()</a></span>}</span><br>
</div>
</div></p>
<div class="REFBODY"><p>
        <p>The <span class="code">sync/1</span> function ensures that the contents of the 
          log are actually written to the disk. 
          This is usually a rather expensive operation.
          </p>
      </p></div>
    <p><a name="truncate-1"></a><span class="bold_code">truncate(Log) -&gt; ok | {error, trunc_error_rsn()}</span><br><a name="truncate-2"></a><span class="bold_code">truncate(Log, Head) -&gt; ok | {error, trunc_error_rsn()}</span><br><a name="btruncate-2"></a><span class="bold_code">btruncate(Log, BHead) -&gt; ok | {error, trunc_error_rsn()}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Log = <span class="bold_code"><a href="#type-log">log()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code">Head = term()</span></div>
<div class="REFTYPES"><span class="bold_code">BHead = <span class="bold_code"><a href="#type-bytes">bytes()</a></span></span></div>
<div class="REFTYPES">
      <span class="bold_code">trunc_error_rsn() = no_such_log<br>                  | nonode<br>                  | {read_only_mode, <span class="bold_code"><a href="#type-log">log()</a></span>}<br>                  | {blocked_log, <span class="bold_code"><a href="#type-log">log()</a></span>}<br>                  | {invalid_header, <span class="bold_code"><a href="#type-invalid_header">invalid_header()</a></span>}<br>                  | {file_error, <span class="bold_code"><a href="file.html#type-filename">file:filename()</a></span>, <span class="bold_code"><a href="#type-file_error">file_error()</a></span>}</span><br>
</div>
</div></p>
<div class="REFBODY"><p>
        <p>The <span class="code">truncate</span> functions remove all items from a disk log.
          If the <span class="code">Head</span> or the <span class="code">BHead</span> argument is
          given, this item is written first in the newly truncated
          log, otherwise the header given to <span class="code">open/1</span> is used.
          The header argument is only used once; next time a wrap log file 
          is opened, the header given to <span class="code">open/1</span> is used.
          </p>
        <p>The <span class="code">truncate/1,2</span> functions are used for internally 
          formatted logs, and <span class="code">btruncate/2</span> for externally formatted
          logs.
          </p>
        <p>The owners that subscribe to notifications will receive 
          a <span class="code">truncate</span> message.
          </p>
        <p>If the attempt to truncate the log fails, the disk log process
          terminates with the EXIT message 
          <span class="code">{{failed,Reason},[{disk_log,Fun,Arity}]}</span>, and 
          other processes that have requests queued receive the message 
          <span class="code">{disk_log, Node, {error, disk_log_stopped}}</span>.
          </p>
      </p></div>
    <p><a name="unblock-1"></a><span class="bold_code">unblock(Log) -&gt; ok | {error, unblock_error_rsn()}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Log = <span class="bold_code"><a href="#type-log">log()</a></span></span></div>
<div class="REFTYPES">
      <span class="bold_code">unblock_error_rsn() = no_such_log<br>                    | nonode<br>                    | {not_blocked, <span class="bold_code"><a href="#type-log">log()</a></span>}<br>                    | {not_blocked_by_pid, <span class="bold_code"><a href="#type-log">log()</a></span>}</span><br>
</div>
</div></p>
<div class="REFBODY"><p>
        <p>The <span class="code">unblock/1</span> function unblocks a log. 
          A log can only be unblocked by the blocking process.
          </p>
      </p></div>
  

  <h3><a name="id107506">See Also</a></h3>
<div class="REFBODY">
    
    <p><span class="bold_code"><a href="file.html">file(3)</a></span>, 
      <span class="bold_code"><a href="pg2.html">pg2(3)</a></span>, 
      <span class="bold_code"><a href="wrap_log_reader.html">wrap_log_reader(3)</a></span></p>
  </div>
</div>
<div class="footer">
<hr>
<p>Copyright © 1997-2012 Ericsson AB. All Rights Reserved.</p>
</div>
</div>
</div></body>
</html>