~ubuntu-branches/ubuntu/trusty/erlang/trusty

« back to all changes in this revision

Viewing changes to lib/dialyzer/test/r9c_tests_SUITE_data/src/inets/httpd_verbosity.erl

  • Committer: Bazaar Package Importer
  • Author(s): Clint Byrum
  • Date: 2011-05-05 15:48:43 UTC
  • mfrom: (3.5.13 sid)
  • Revision ID: james.westby@ubuntu.com-20110505154843-0om6ekzg6m7ugj27
Tags: 1:14.b.2-dfsg-3ubuntu1
* Merge from debian unstable.  Remaining changes:
  - Drop libwxgtk2.8-dev build dependency. Wx isn't in main, and not
    supposed to.
  - Drop erlang-wx binary.
  - Drop erlang-wx dependency from -megaco, -common-test, and -reltool, they
    do not really need wx. Also drop it from -debugger; the GUI needs wx,
    but it apparently has CLI bits as well, and is also needed by -megaco,
    so let's keep the package for now.
  - debian/patches/series: Do what I meant, and enable build-options.patch
    instead.
* Additional changes:
  - Drop erlang-wx from -et
* Dropped Changes:
  - patches/pcre-crash.patch: CVE-2008-2371: outer level option with
    alternatives caused crash. (Applied Upstream)
  - fix for ssl certificate verification in newSSL: 
    ssl_cacertfile_fix.patch (Applied Upstream)
  - debian/patches/series: Enable native.patch again, to get stripped beam
    files and reduce the package size again. (build-options is what
    actually accomplished this)
  - Remove build-options.patch on advice from upstream and because it caused
    odd build failures.

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: httpd_verbosity.erl,v 1.1 2008/12/17 09:53:34 mikpe Exp $
 
17
%%
 
18
-module(httpd_verbosity).
 
19
 
 
20
-include_lib("stdlib/include/erl_compile.hrl").
 
21
 
 
22
-export([print/4,print/5,printc/4,validate/1]).
 
23
 
 
24
print(silence,_Severity,_Format,_Arguments) ->
 
25
    ok;
 
26
print(Verbosity,Severity,Format,Arguments) ->
 
27
    print1(printable(Verbosity,Severity),Format,Arguments).
 
28
 
 
29
 
 
30
print(silence,_Severity,_Module,_Format,_Arguments) ->
 
31
    ok;
 
32
print(Verbosity,Severity,Module,Format,Arguments) ->
 
33
    print1(printable(Verbosity,Severity),Module,Format,Arguments).
 
34
 
 
35
 
 
36
printc(silence,Severity,Format,Arguments) ->
 
37
    ok;
 
38
printc(Verbosity,Severity,Format,Arguments) ->
 
39
    print2(printable(Verbosity,Severity),Format,Arguments).
 
40
 
 
41
 
 
42
print1(false,_Format,_Arguments) -> ok;
 
43
print1(Verbosity,Format,Arguments) ->
 
44
    V = image_of_verbosity(Verbosity),
 
45
    S = image_of_sname(get(sname)),
 
46
    io:format("** HTTPD ~s ~s: " ++ Format ++ "~n",[S,V]++Arguments).
 
47
 
 
48
print1(false,_Module,_Format,_Arguments) -> ok;
 
49
print1(Verbosity,Module,Format,Arguments) ->
 
50
    V = image_of_verbosity(Verbosity),
 
51
    S = image_of_sname(get(sname)),
 
52
    io:format("** HTTPD ~s ~s ~s: " ++ Format ++ "~n",[S,Module,V]++Arguments).
 
53
 
 
54
 
 
55
print2(false,_Format,_Arguments) -> ok;
 
56
print2(_Verbosity,Format,Arguments) ->
 
57
    io:format(Format ++ "~n",Arguments).
 
58
 
 
59
 
 
60
%% printable(Verbosity,Severity)
 
61
printable(info,info)      -> info;
 
62
printable(log,info)       -> info;
 
63
printable(log,log)        -> log;
 
64
printable(debug,info)     -> info;
 
65
printable(debug,log)      -> log;
 
66
printable(debug,debug)    -> debug;
 
67
printable(trace,V)        -> V;
 
68
printable(_Verb,_Sev)     -> false.
 
69
 
 
70
 
 
71
image_of_verbosity(info)  -> "INFO";
 
72
image_of_verbosity(log)   -> "LOG";
 
73
image_of_verbosity(debug) -> "DEBUG";
 
74
image_of_verbosity(trace) -> "TRACE";
 
75
image_of_verbosity(_)     -> "".
 
76
 
 
77
%% ShortName
 
78
image_of_sname(acc)           -> "ACCEPTOR";
 
79
image_of_sname(acc_sup)       -> "ACCEPTOR_SUP";
 
80
image_of_sname(auth)          -> "AUTH";
 
81
image_of_sname(man)           -> "MANAGER";
 
82
image_of_sname(misc_sup)      -> "MISC_SUP";
 
83
image_of_sname(sec)           -> "SECURITY";
 
84
image_of_sname(P) when pid(P) -> io_lib:format("REQUEST_HANDLER(~p)",[P]);
 
85
image_of_sname(undefined)     -> "";
 
86
image_of_sname(V)             -> io_lib:format("~p",[V]).
 
87
 
 
88
 
 
89
validate(info)  -> info;
 
90
validate(log)   -> log;
 
91
validate(debug) -> debug;
 
92
validate(trace) -> trace;
 
93
validate(_)     -> silence.
 
94