diff options
author | Jan Lehnardt <jan@apache.org> | 2009-05-12 19:36:15 +0000 |
---|---|---|
committer | Jan Lehnardt <jan@apache.org> | 2009-05-12 19:36:15 +0000 |
commit | 7c76d131110e4641114e3066844e7195efb2f33b (patch) | |
tree | fc7e7f4af83b58adeb2b3eba11ad3876fc2a788d /src/couchdb/couch_util.erl | |
parent | b37ce2b377cff6c3e358adf4963ae6290942fae7 (diff) |
Add non-streaming log-file handler. A GET request to /_log will show the last 1000 bytes of the logflie. More bytes can be requested with GET /_log?bytes=10000.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@774045 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_util.erl')
-rw-r--r-- | src/couchdb/couch_util.erl | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/couchdb/couch_util.erl b/src/couchdb/couch_util.erl index a119cf1c..0a715520 100644 --- a/src/couchdb/couch_util.erl +++ b/src/couchdb/couch_util.erl @@ -17,8 +17,10 @@ -export([new_uuid/0, rand32/0, implode/2, collate/2, collate/3]). -export([abs_pathname/1,abs_pathname/2, trim/1, ascii_lower/1]). -export([encodeBase64/1, decodeBase64/1, to_hex/1,parse_term/1,dict_find/3]). +-export([file_read_size/1]). -include("couch_db.hrl"). +-include_lib("kernel/include/file.hrl"). % arbitrarily chosen amount of memory to use before flushing to disk -define(FLUSH_MAX_MEM, 10000000). @@ -291,3 +293,11 @@ dict_find(Key, Dict, DefaultValue) -> error -> DefaultValue end. + + +file_read_size(FileName) -> + case file:read_file_info(FileName) of + {ok, FileInfo} -> + FileInfo#file_info.size; + Error -> Error + end. |