~ubuntu-branches/debian/squeeze/erlang/squeeze

« back to all changes in this revision

Viewing changes to lib/eva/example/ex_log.erl

  • Committer: Bazaar Package Importer
  • Author(s): Erlang Packagers, Sergei Golovan
  • Date: 2006-12-03 17:07:44 UTC
  • mfrom: (2.1.11 feisty)
  • Revision ID: james.westby@ubuntu.com-20061203170744-rghjwupacqlzs6kv
Tags: 1:11.b.2-4
[ Sergei Golovan ]
Fixed erlang-base and erlang-base-hipe prerm scripts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
%% ``The contents of this file are subject to the Erlang Public License,
2
 
%% Version 1.1, (the "License"); you may not use this file except in
3
 
%% compliance with the License. You should have received a copy of the
4
 
%% Erlang Public License along with this software. If not, it can be
5
 
%% retrieved via the world wide web at http://www.erlang.org/.
6
 
%% 
7
 
%% Software distributed under the License is distributed on an "AS IS"
8
 
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
9
 
%% the License for the specific language governing rights and limitations
10
 
%% under the License.
11
 
%% 
12
 
%% The Initial Developer of the Original Code is Ericsson Utvecklings AB.
13
 
%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings
14
 
%% AB. All Rights Reserved.''
15
 
%% 
16
 
%%     $Id$
17
 
%%
18
 
-module(ex_log).
19
 
-compile(export_all).
20
 
 
21
 
init() ->
22
 
    file:make_dir("ex_log").
23
 
 
24
 
%S1
25
 
start() ->
26
 
    disk_log:open([{name, "ex_log"},
27
 
                   {file, "ex_log/ex_log.LOG"},
28
 
                   {type, wrap},
29
 
                   {size, {10000, 4}}]),
30
 
    log:open("ex_log", ex_log_type, 3600).
31
 
 
32
 
test() ->
33
 
    %% Log an item
34
 
    disk_log:log("ex_log", {1, "log this"}),
35
 
 
36
 
    %% Set the administrative status of the log to 'down'
37
 
    log:set_admin_status("ex_log", down),
38
 
    
39
 
    %% Try  to log - this one won't be logged
40
 
    disk_log:log("ex_log", {2, "won't be logged"}),
41
 
    
42
 
    Logs1 = log:get_logs(),
43
 
 
44
 
    %% Set the administrative status of the log to 'up'
45
 
    log:set_admin_status("ex_log", up),
46
 
    
47
 
    %% Log an item
48
 
    disk_log:log("ex_log", {3, "log this"}),
49
 
 
50
 
    Logged = disk_log:chunk("ex_log", start),
51
 
    {Logs1, Logged}.
52
 
%S1