slf4r 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/log4r_adapter.rb CHANGED
@@ -8,5 +8,9 @@ module Log4r
8
8
  def method_missing(method, *args, &block)
9
9
  @logger.send(method, *args, &block) if @logger.respond_to?(method)
10
10
  end
11
+
12
+ def respend_to?(method)
13
+ @logger.respond_to?(method)
14
+ end
11
15
  end
12
16
  end
@@ -12,5 +12,9 @@ module Logging
12
12
  def method_missing(method, *args, &block)
13
13
  @logger.send(method, *args, &block) if @logger.respond_to?(method)
14
14
  end
15
+
16
+ def respend_to?(method)
17
+ @logger.respond_to?(method)
18
+ end
15
19
  end
16
20
  end
@@ -23,4 +23,8 @@ class Logger
23
23
  def method_missing(method, *args, &block)
24
24
  @logger.send(method, *args, &block) if @logger.respond_to?(method)
25
25
  end
26
+
27
+ def respend_to?(method)
28
+ @logger.respond_to?(method)
29
+ end
26
30
  end
@@ -0,0 +1,41 @@
1
+ require 'java'
2
+ module Slf4r
3
+ class LoggerFacade
4
+
5
+ protected
6
+
7
+ def format(exception)
8
+ (": #{exception.message}:\n\t#{exception.backtrace.join("\n\t") if exception.backtrace }") if exception
9
+ end
10
+
11
+ public
12
+
13
+ attr_reader :name
14
+
15
+ attr_reader :logger
16
+
17
+ def initialize(name)
18
+ @name = name
19
+ @logger = org.slf4j.LoggerFactory.getLogger(name.to_s.sub(/^::/, '').gsub(/::/, '.'))
20
+ end
21
+
22
+ [:debug, :info, :warn, :error].each do |level|
23
+ class_eval <<-CODE
24
+ def #{level}?
25
+ @logger.is_#{level}_enabled
26
+ end
27
+
28
+ def #{level}(msg = nil, exception = nil)
29
+ if(@logger.is_#{level}_enabled)
30
+ msg, exception = yield if block_given?
31
+ if(exception.type == NativeException)
32
+ @logger.#{level}(msg, exception.cause)
33
+ else
34
+ @logger.#{level}("\#{msg}\#{format(exception)}")
35
+ end
36
+ end
37
+ end
38
+ CODE
39
+ end
40
+ end
41
+ end
@@ -25,39 +25,40 @@ module Slf4r
25
25
  @logger.add(type, msg)
26
26
  end
27
27
 
28
- public
29
-
30
- def debug?
31
- @logger.level == 0
32
- end
28
+ protected
33
29
 
34
30
  def _debug(msg)
35
31
  log(0, msg)
36
32
  end
37
33
 
38
- def info?
39
- @logger.level <= 1
40
- end
41
-
42
34
  def _info(msg)
43
35
  log(1, msg)
44
36
  end
45
37
 
46
- def warn?
47
- @logger.level <= 2
48
- end
49
-
50
38
  def _warn(msg)
51
39
  log(2, msg)
52
40
  end
53
41
 
54
- def error?
55
- @logger.level <= 3
56
- end
57
-
58
42
  def _error(msg)
59
43
  log(3, msg)
60
44
  end
61
-
45
+
46
+ public
47
+
48
+ def debug?
49
+ @logger.level == 0
50
+ end
51
+
52
+ def info?
53
+ @logger.level <= 1
54
+ end
55
+
56
+ def warn?
57
+ @logger.level <= 2
58
+ end
59
+
60
+ def error?
61
+ @logger.level <= 3
62
+ end
62
63
  end
63
64
  end
@@ -1,16 +1,16 @@
1
- require 'logger.rb'
1
+ require 'logger'
2
2
  require 'slf4r/abstract_logger_facade'
3
3
 
4
4
  module Slf4r
5
5
  class LoggerFacade4RubyLogger
6
6
 
7
- @@level = ::Logger::INFO
8
7
  @@file = STDERR
9
8
  @@datetime_format = "%Y-%m-%d %H:%M:%S "
10
9
 
11
10
  def self.new_logger_facade(name)
12
11
  @name = name
13
12
  @logger = ::Logger.new(@@file)
13
+ @@level = ::Logger::INFO unless self.class_variable_defined?(:@@level)
14
14
  @logger.level = @@level
15
15
  @logger.datetime_format = @@datetime_format
16
16
  @logger
@@ -18,7 +18,7 @@ module Slf4r
18
18
 
19
19
  def self.level=(level)
20
20
  @@level = level.instance_of?(Fixnum) ? level :
21
- ::Logger.get_const(level.to_s.upcase)
21
+ ::Logger.const_get(level.to_s.upcase)
22
22
  end
23
23
 
24
24
  def self.datetime_format=(format)
@@ -43,38 +43,40 @@ module Slf4r
43
43
  @logger.add(type, msg, @name)
44
44
  end
45
45
 
46
+ protected
47
+
48
+ def _debug(msg)
49
+ log(::Logger::DEBUG, msg)
50
+ end
51
+
52
+ def _info(msg)
53
+ log(::Logger::INFO, msg)
54
+ end
55
+
56
+ def _warn(msg)
57
+ log(::Logger::WARN, msg)
58
+ end
59
+
60
+ def _error(msg)
61
+ log(::Logger::ERROR, msg)
62
+ end
63
+
46
64
  public
47
65
 
48
66
  def debug?
49
67
  @logger.debug?
50
68
  end
51
69
 
52
- def _debug(msg)
53
- log(::Logger::DEBUG, msg)
54
- end
55
-
56
70
  def info?
57
71
  @logger.info?
58
72
  end
59
73
 
60
- def _info(msg)
61
- log(::Logger::INFO, msg)
62
- end
63
-
64
74
  def warn?
65
75
  @logger.warn?
66
76
  end
67
77
 
68
- def _warn(msg)
69
- log(::Logger::WARN, msg)
70
- end
71
-
72
78
  def error?
73
79
  @logger.error?
74
80
  end
75
-
76
- def _error(msg)
77
- log(::Logger::ERROR, msg)
78
- end
79
81
  end
80
82
  end
data/lib/slf4r/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Slf4r
2
- VERSION = '0.2.0'
2
+ VERSION = '0.3.0'
3
3
  end
File without changes
data/lib/slf4r.rb CHANGED
@@ -1,8 +1,6 @@
1
- require 'rubygems'
2
- require 'pathname'
3
-
4
- dir = Pathname(__FILE__).dirname.expand_path + 'slf4r'
5
-
6
- require dir + 'version'
7
- require dir + 'logger'
8
- require dir + 'ruby_logger'
1
+ require 'slf4r/logger'
2
+ begin
3
+ require 'slf4r/java_logger'
4
+ rescue
5
+ require 'slf4r/ruby_logger'
6
+ end
@@ -0,0 +1,446 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7
+ <link rel="shortcut icon" href="/files/garland_favicon.png" type="image/x-icon" />
8
+ <!--[if lt IE 7]>
9
+ <script defer type="text/javascript" src="/files/pngfix.js"></script>
10
+ <![endif]-->
11
+ <title>Open Source Initiative OSI - The MIT License:Licensing | Open Source Initiative</title>
12
+ <link type="text/css" rel="stylesheet" media="all" href="/modules/aggregator/aggregator.css?k" />
13
+ <link type="text/css" rel="stylesheet" media="all" href="/modules/node/node.css?k" />
14
+ <link type="text/css" rel="stylesheet" media="all" href="/modules/system/defaults.css?k" />
15
+ <link type="text/css" rel="stylesheet" media="all" href="/modules/system/system.css?k" />
16
+ <link type="text/css" rel="stylesheet" media="all" href="/modules/system/system-menus.css?k" />
17
+ <link type="text/css" rel="stylesheet" media="all" href="/modules/user/user.css?k" />
18
+ <link type="text/css" rel="stylesheet" media="all" href="/modules/forum/forum.css?k" />
19
+ <link type="text/css" rel="stylesheet" media="all" href="/modules/comment/comment.css?k" />
20
+ <link type="text/css" rel="stylesheet" media="all" href="/files/color/garland-4208c934/style.css?k" />
21
+ <link type="text/css" rel="stylesheet" media="print" href="/themes/garland/print.css?k" />
22
+ <!--[if lt IE 7]>
23
+ <link type="text/css" rel="stylesheet" media="all" href="/themes/garland/fix-ie.css" /> <![endif]-->
24
+ </head>
25
+ <body class="sidebar-left">
26
+
27
+ <!-- Layout -->
28
+ <div id="header-region" class="clear-block"></div>
29
+
30
+ <div id="wrapper">
31
+ <div id="container" class="clear-block">
32
+
33
+ <div id="header">
34
+ <div id="logo-floater">
35
+ <h1><a href="/" title="Open Source Initiative"><img src="/files/garland_logo.png" alt="Open Source Initiative" id="logo" /><span>Open Source Initiative</span></a></h1> </div>
36
+
37
+
38
+ </div> <!-- /header -->
39
+
40
+ <div id="sidebar-left" class="sidebar">
41
+ <div class="block block-theme"><form action="/licenses/mit-license.php" accept-charset="UTF-8" method="post" id="search-theme-form">
42
+ <div><div id="search" class="container-inline">
43
+ <div class="form-item" id="edit-search-theme-form-1-wrapper">
44
+ <label for="edit-search-theme-form-1">Search this site: </label>
45
+ <input type="text" maxlength="128" name="search_theme_form" id="edit-search-theme-form-1" size="15" value="" title="Enter the terms you wish to search for." class="form-text" />
46
+ </div>
47
+ <input type="submit" name="op" id="edit-submit-3" value="Search" class="form-submit" />
48
+ <input type="hidden" name="form_build_id" id="form-170ff38086b4f9c0f4a5721b05fc013c" value="form-170ff38086b4f9c0f4a5721b05fc013c" />
49
+ <input type="hidden" name="form_id" id="edit-search-theme-form" value="search_theme_form" />
50
+ </div>
51
+
52
+ </div></form>
53
+ </div> <div id="block-user-1" class="clear-block block block-user">
54
+
55
+ <h2>Navigation</h2>
56
+
57
+ <div class="content"><ul class="menu"><li class="collapsed first"><a href="/about" title="About the Open Source Initiative">About the OSI</a></li>
58
+ <li class="collapsed"><a href="/docs/osd" title="The actual OSD defining what constitutes an Open Source licence">The Open Source Definition</a></li>
59
+ <li class="collapsed"><a href="/licenses/index.html">Open Source Licenses</a></li>
60
+ <li class="collapsed"><a href="/osr-intro" title="Open Standards Requirement for Software">Open Standards</a></li>
61
+ <li class="leaf"><a href="/osi-open-source-education" title="OSI&#039;s Open Source Education Initiative and Activities">Open Source Education</a></li>
62
+ <li class="collapsed"><a href="/lists" title="The virtual committees where the OSI&#039;s work gets done">Mailing lists</a></li>
63
+ <li class="collapsed"><a href="/help" title="Resources for questions and further exploration">Getting Help</a></li>
64
+ <li class="leaf"><a href="/donate" title="The OSI is a 501(c)3. Donations are tax-deductible on US income taxes.">Donate to the OSI</a></li>
65
+ <li class="leaf last"><a href="/ToS" title="Rules for posting content on this site">Terms of Service</a></li>
66
+ </ul></div>
67
+ </div>
68
+ <div id="block-block-2" class="clear-block block block-block">
69
+
70
+
71
+ <div class="content"><ul>
72
+ <li class="leaf">OSI Board <a href="mailto:osi@opensource.org">email</a></li>
73
+ <li class="leaf">Site Admin <a href="mailto:webmaster@opensource.org">email</a></li>
74
+ </ul></div>
75
+ </div>
76
+ <div id="block-user-0" class="clear-block block block-user">
77
+
78
+ <h2>User login</h2>
79
+
80
+ <div class="content"><form action="/licenses/mit-license.php?destination=node%2F66" accept-charset="UTF-8" method="post" id="user-login-form">
81
+ <div><div class="form-item" id="edit-name-wrapper">
82
+ <label for="edit-name">Username: <span class="form-required" title="This field is required.">*</span></label>
83
+ <input type="text" maxlength="60" name="name" id="edit-name" size="15" value="" class="form-text required" />
84
+ </div>
85
+ <div class="form-item" id="edit-pass-wrapper">
86
+ <label for="edit-pass">Password: <span class="form-required" title="This field is required.">*</span></label>
87
+ <input type="password" name="pass" id="edit-pass" maxlength="60" size="15" class="form-text required" />
88
+ </div>
89
+ <input type="submit" name="op" id="edit-submit-2" value="Log in" class="form-submit" />
90
+ <div class="item-list"><ul><li class="first"><a href="/user/register" title="Create a new user account.">Create new account</a></li>
91
+ <li class="last"><a href="/user/password" title="Request new password via e-mail.">Request new password</a></li>
92
+ </ul></div><input type="hidden" name="form_build_id" id="form-fa0c8fdd7cb8c41199a3f7de7460d66e" value="form-fa0c8fdd7cb8c41199a3f7de7460d66e" />
93
+ <input type="hidden" name="form_id" id="edit-user-login-block" value="user_login_block" />
94
+
95
+ </div></form>
96
+ </div>
97
+ </div>
98
+ </div>
99
+
100
+ <div id="center"><div id="squeeze"><div class="right-corner"><div class="left-corner">
101
+ <div class="breadcrumb"><a href="/">Home</a></div> <h2>Open Source Initiative OSI - The MIT License:Licensing</h2> <div class="clear-block">
102
+ <div id="node-66" class="node">
103
+
104
+
105
+
106
+
107
+ <div class="content clear-block">
108
+ <img style="float: right; margin: 1em;" width="100" height="137" alt="[OSI Approved License]" src="/trademarks/opensource/
109
+ OSI-Approved-License-100x137.png"/>
110
+ <p>The MIT License</p>
111
+ <p>Copyright (c) &lt;year&gt; &lt;copyright holders&gt;</p>
112
+ <p>Permission is hereby granted, free of charge, to any person obtaining a copy<br />
113
+ of this software and associated documentation files (the "Software"), to deal<br />
114
+ in the Software without restriction, including without limitation the rights<br />
115
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell<br />
116
+ copies of the Software, and to permit persons to whom the Software is<br />
117
+ furnished to do so, subject to the following conditions:</p>
118
+ <p>The above copyright notice and this permission notice shall be included in<br />
119
+ all copies or substantial portions of the Software.</p>
120
+ <p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br />
121
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br />
122
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE<br />
123
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br />
124
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,<br />
125
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN<br />
126
+ THE SOFTWARE.</p>
127
+ </div>
128
+
129
+ <div class="clear-block">
130
+ <div class="meta">
131
+ </div>
132
+
133
+ <div class="links"><ul class="links inline"><li class="comment_forbidden first last"><span><a href="/user/login?destination=comment%2Freply%2F66%23comment-form">Login</a> or <a href="/user/register?destination=comment%2Freply%2F66%23comment-form">register</a> to post comments</span></li>
134
+ </ul></div>
135
+ </div>
136
+
137
+ </div>
138
+ <div id="comments">
139
+ <h2 class="comments">Comments</h2><form action="/licenses/mit-license.php" accept-charset="UTF-8" method="post" id="comment-controls">
140
+ <div><div class="box">
141
+
142
+ <h2>Comment viewing options</h2>
143
+
144
+ <div class="content"><div class="container-inline"><input type="hidden" name="form_build_id" id="form-10b484a00b7df2bbcad3d924d5376ac3" value="form-10b484a00b7df2bbcad3d924d5376ac3" />
145
+ <input type="hidden" name="form_id" id="edit-comment-controls" value="comment_controls" />
146
+ <div class="form-item" id="edit-mode-wrapper">
147
+ <select name="mode" class="form-select" id="edit-mode" ><option value="1">Flat list - collapsed</option><option value="2">Flat list - expanded</option><option value="3">Threaded list - collapsed</option><option value="4" selected="selected">Threaded list - expanded</option></select>
148
+ </div>
149
+ <div class="form-item" id="edit-order-wrapper">
150
+ <select name="order" class="form-select" id="edit-order" ><option value="1" selected="selected">Date - newest first</option><option value="2">Date - oldest first</option></select>
151
+ </div>
152
+ <div class="form-item" id="edit-comments-per-page-wrapper">
153
+ <select name="comments_per_page" class="form-select" id="edit-comments-per-page" ><option value="10">10 comments per page</option><option value="30">30 comments per page</option><option value="50" selected="selected">50 comments per page</option><option value="70">70 comments per page</option><option value="90">90 comments per page</option><option value="150">150 comments per page</option><option value="200">200 comments per page</option><option value="250">250 comments per page</option><option value="300">300 comments per page</option></select>
154
+ </div>
155
+ <input type="submit" name="op" id="edit-submit" value="Save settings" class="form-submit" />
156
+ </div><div class="description">Select your preferred way to display the comments and click "Save settings" to activate your changes.</div></div>
157
+ </div>
158
+
159
+ </div></form>
160
+ <a id="comment-1308"></a>
161
+ <div class="comment comment-published odd">
162
+
163
+ <div class="clear-block">
164
+ <span class="submitted">Thu, 2010-04-15 23:11 — opensourcefan</span>
165
+
166
+
167
+
168
+ <h3><a href="/licenses/mit-license.php#comment-1308" class="active">Copyleft or not?</a></h3>
169
+
170
+ <div class="content">
171
+ <p>&gt;The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.<br />
172
+ Then why does Wikipedia state (unreferenced) this license is NOT copyleft? Does Wikipedia need fixing? Is there a reliable source about this?</p>
173
+ </div>
174
+ </div>
175
+
176
+ <div class="links"><ul class="links"><li class="comment_forbidden first last"><span><a href="/user/login?destination=comment%2Freply%2F66%23comment-form">Login</a> or <a href="/user/register?destination=comment%2Freply%2F66%23comment-form">register</a> to post comments</span></li>
177
+ </ul></div>
178
+ </div>
179
+ <a id="comment-1272"></a>
180
+ <div class="comment comment-published even">
181
+
182
+ <div class="clear-block">
183
+ <span class="submitted">Tue, 2010-03-16 06:37 — aladdin</span>
184
+
185
+
186
+
187
+ <h3><a href="/licenses/mit-license.php#comment-1272" class="active">Sublicensing</a></h3>
188
+
189
+ <div class="content">
190
+ <p>If I obtain code under the MIT license, then make changes to it. Can I sub-license it under my own terms? Or do I have to still include their original MIT license with my software.</p>
191
+ <p>Basically I'm creating software that contains MIT licensed code, but I want to sell it with my own sub-license for the end users so they can't redistribute it for free.</p>
192
+ </div>
193
+ </div>
194
+
195
+ <div class="links"><ul class="links"><li class="comment_forbidden first last"><span><a href="/user/login?destination=comment%2Freply%2F66%23comment-form">Login</a> or <a href="/user/register?destination=comment%2Freply%2F66%23comment-form">register</a> to post comments</span></li>
196
+ </ul></div>
197
+ </div>
198
+ <a id="comment-1172"></a>
199
+ <div class="comment comment-published odd">
200
+
201
+ <div class="clear-block">
202
+ <span class="submitted">Fri, 2010-01-08 13:44 — Samuel72</span>
203
+
204
+
205
+
206
+ <h3><a href="/licenses/mit-license.php#comment-1172" class="active">How To Comply</a></h3>
207
+
208
+ <div class="content">
209
+ <p>I'd like to use some MIT-licensed xml-parsing code in my iPhone game. This seems to require that I package the MIT license with the application. However, my iPhone app does not include extensive documentation and my demographic will not want legal notices shoved in their faces.</p>
210
+ <p>My boss is afraid of using this code because our company is very small and doesn't have the money for any type of legal battle. What is the best way to comply with the MIT license in an iPhone app without compromising user experience?<br />
211
+ ___________<br />
212
+ Samuel Fattizi</p>
213
+ </div>
214
+ </div>
215
+
216
+ <div class="links"><ul class="links"><li class="comment_forbidden first last"><span><a href="/user/login?destination=comment%2Freply%2F66%23comment-form">Login</a> or <a href="/user/register?destination=comment%2Freply%2F66%23comment-form">register</a> to post comments</span></li>
217
+ </ul></div>
218
+ </div>
219
+ <a id="comment-1123"></a>
220
+ <div class="comment comment-published even">
221
+
222
+ <div class="clear-block">
223
+ <span class="submitted">Tue, 2009-07-28 07:47 — searlea</span>
224
+
225
+
226
+
227
+ <h3><a href="/licenses/mit-license.php#comment-1123" class="active">Referring to license via URL</a></h3>
228
+
229
+ <div class="content">
230
+ <p>Is it sufficient to refer to the license via URL? I want to modify and use some code that only refers to the license via:</p>
231
+ <p>/* Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php */</p>
232
+ <p>Is it OK to integrate code within a larger code-base (e.g. using some MIT-licensed JavaScript within a larger javascript library) with a wrapper / comment inserted in the appropriate place:</p>
233
+ <p>/* Function foobar derived from MIT-licensed code: http://www.opensource.org/licenses/mit-license.php */</p>
234
+ <p>Note: I've no idea of the legal significance of changing "Licensed under the MIT license" to "Derived from MIT licensed code" - hence the question.</p>
235
+ </div>
236
+ </div>
237
+
238
+ <div class="links"><ul class="links"><li class="comment_forbidden first last"><span><a href="/user/login?destination=comment%2Freply%2F66%23comment-form">Login</a> or <a href="/user/register?destination=comment%2Freply%2F66%23comment-form">register</a> to post comments</span></li>
239
+ </ul></div>
240
+ </div>
241
+ <div class="indented"><a id="comment-1153"></a>
242
+ <div class="comment comment-published odd">
243
+
244
+ <div class="clear-block">
245
+ <span class="submitted">Mon, 2009-12-28 14:41 — shlomif</span>
246
+
247
+
248
+
249
+ <h3><a href="/licenses/mit-license.php#comment-1153" class="active">I think so.</a></h3>
250
+
251
+ <div class="content">
252
+ <p>I am not a lawyer, but I think it's good enough. A lot of JavaScript out there does not put the entire licence blurb there to save space. Pedantics (like the Debian project) also need a "Copyright by Foo Bar, 2009" statement.</p>
253
+ <p>Regarding the wrapper - it should be OK, but make sure you also reproduce the copyright blurb and a link to the one who originated it. I should note that MIT/X11-licensed code can be sub-licensed to any other licence.</p>
254
+ <p>------------------</p>
255
+ <p>Shlomi Fish, http://www.shlomifish.org/</p>
256
+ <p>When Chuck Norris uses Gentoo, "emerge kde" finishes in under a minute. A computer cannot afford to keep Chuck waiting for too long.</p>
257
+ </div>
258
+ </div>
259
+
260
+ <div class="links"><ul class="links"><li class="comment_forbidden first last"><span><a href="/user/login?destination=comment%2Freply%2F66%23comment-form">Login</a> or <a href="/user/register?destination=comment%2Freply%2F66%23comment-form">register</a> to post comments</span></li>
261
+ </ul></div>
262
+ </div>
263
+ </div><a id="comment-1122"></a>
264
+ <div class="comment comment-published even">
265
+
266
+ <div class="clear-block">
267
+ <span class="submitted">Mon, 2009-07-27 16:18 — matthew123</span>
268
+
269
+
270
+
271
+ <h3><a href="/licenses/mit-license.php#comment-1122" class="active">Another question</a></h3>
272
+
273
+ <div class="content">
274
+ <p>If we are making a closed source application, selling this application for profit, include this license in the open source license file, are we breaking any laws?</p>
275
+ <p>Thank you for your time.</p>
276
+ </div>
277
+ </div>
278
+
279
+ <div class="links"><ul class="links"><li class="comment_forbidden first last"><span><a href="/user/login?destination=comment%2Freply%2F66%23comment-form">Login</a> or <a href="/user/register?destination=comment%2Freply%2F66%23comment-form">register</a> to post comments</span></li>
280
+ </ul></div>
281
+ </div>
282
+ <div class="indented"><a id="comment-1154"></a>
283
+ <div class="comment comment-published odd">
284
+
285
+ <div class="clear-block">
286
+ <span class="submitted">Mon, 2009-12-28 14:47 — shlomif</span>
287
+
288
+
289
+
290
+ <h3><a href="/licenses/mit-license.php#comment-1154" class="active">It&#039;s perfectly OK.</a></h3>
291
+
292
+ <div class="content">
293
+ <p>Feel free to use MIT/X11 licensed code in your non-open-source apps. You are allowed to link to such code from your application or even change the licence of derivative works (see the permission to "sub-license"). What you may need to do is give attribution:</p>
294
+ <p>http://en.wikipedia.org/wiki/Attribution_%28copyright%29</p>
295
+ <p>I.e: say "libfunctionality , Copyright by J. Random Hacker, 2009" somewhere. But it would be hard to avoid giving attribution in practically all copyrighted open source code out there.</p>
296
+ <p>------------------</p>
297
+ <p>Shlomi Fish, http://www.shlomifish.org/</p>
298
+ <p>When Chuck Norris uses Gentoo, "emerge kde" finishes in under a minute. A computer cannot afford to keep Chuck waiting for too long.</p>
299
+ </div>
300
+ </div>
301
+
302
+ <div class="links"><ul class="links"><li class="comment_forbidden first last"><span><a href="/user/login?destination=comment%2Freply%2F66%23comment-form">Login</a> or <a href="/user/register?destination=comment%2Freply%2F66%23comment-form">register</a> to post comments</span></li>
303
+ </ul></div>
304
+ </div>
305
+ </div><a id="comment-1116"></a>
306
+ <div class="comment comment-published even">
307
+
308
+ <div class="clear-block">
309
+ <span class="submitted">Fri, 2009-07-24 06:07 — trajavarma</span>
310
+
311
+
312
+
313
+ <h3><a href="/licenses/mit-license.php#comment-1116" class="active">A Question</a></h3>
314
+
315
+ <div class="content">
316
+ <p>I downloaded a software under this License.<br />
317
+ Upon the original software I have made several changes.<br />
318
+ I would like to release our it with those changes. </p>
319
+ <p>What kind of licensing can it go with ?(with the Same license ?)<br />
320
+ Is it possible to keep the changes under my name ?</p>
321
+ </div>
322
+ </div>
323
+
324
+ <div class="links"><ul class="links"><li class="comment_forbidden first last"><span><a href="/user/login?destination=comment%2Freply%2F66%23comment-form">Login</a> or <a href="/user/register?destination=comment%2Freply%2F66%23comment-form">register</a> to post comments</span></li>
325
+ </ul></div>
326
+ </div>
327
+ <a id="comment-991"></a>
328
+ <div class="comment comment-published odd">
329
+
330
+ <div class="clear-block">
331
+ <span class="submitted">Wed, 2009-04-29 16:52 — HraKK</span>
332
+
333
+
334
+
335
+ <h3><a href="/licenses/mit-license.php#comment-991" class="active">How can i use this?</a></h3>
336
+
337
+ <div class="content">
338
+ <p>If i want distribute open source system CMS on my site http://correct.com.ua/ can i use this license?</p>
339
+ </div>
340
+ </div>
341
+
342
+ <div class="links"><ul class="links"><li class="comment_forbidden first last"><span><a href="/user/login?destination=comment%2Freply%2F66%23comment-form">Login</a> or <a href="/user/register?destination=comment%2Freply%2F66%23comment-form">register</a> to post comments</span></li>
343
+ </ul></div>
344
+ </div>
345
+ <div class="indented"><a id="comment-1102"></a>
346
+ <div class="comment comment-published even">
347
+
348
+ <div class="clear-block">
349
+ <span class="submitted">Fri, 2009-07-17 19:37 — nelson</span>
350
+
351
+
352
+
353
+ <h3><a href="/licenses/mit-license.php#comment-1102" class="active">Yes, of course you can use</a></h3>
354
+
355
+ <div class="content">
356
+ <p>Yes, of course you can use this license. Just include the text of the license in a file called "LICENSE", and make reference to it in a file called "README".</p>
357
+ </div>
358
+ </div>
359
+
360
+ <div class="links"><ul class="links"><li class="comment_forbidden first last"><span><a href="/user/login?destination=comment%2Freply%2F66%23comment-form">Login</a> or <a href="/user/register?destination=comment%2Freply%2F66%23comment-form">register</a> to post comments</span></li>
361
+ </ul></div>
362
+ </div>
363
+ </div><a id="comment-935"></a>
364
+ <div class="comment comment-published odd">
365
+
366
+ <div class="clear-block">
367
+ <span class="submitted">Fri, 2009-03-13 19:53 — MartinMusatov</span>
368
+
369
+
370
+
371
+ <h3><a href="/licenses/mit-license.php#comment-935" class="active">Additional Clause Requested</a></h3>
372
+
373
+ <div class="content">
374
+ <p>As stated the law allows abuses of software. Require a clause that no malicious uses may be entered into with said program conditional of any use.<br />
375
+ Martin M. Musatov</p>
376
+ </div>
377
+ </div>
378
+
379
+ <div class="links"><ul class="links"><li class="comment_forbidden first last"><span><a href="/user/login?destination=comment%2Freply%2F66%23comment-form">Login</a> or <a href="/user/register?destination=comment%2Freply%2F66%23comment-form">register</a> to post comments</span></li>
380
+ </ul></div>
381
+ </div>
382
+ <div class="indented"><a id="comment-1103"></a>
383
+ <div class="comment comment-published even">
384
+
385
+ <div class="clear-block">
386
+ <span class="submitted">Fri, 2009-07-17 19:38 — nelson</span>
387
+
388
+
389
+
390
+ <h3><a href="/licenses/mit-license.php#comment-1103" class="active">The problem with a clause</a></h3>
391
+
392
+ <div class="content">
393
+ <p>The problem with a clause like that is: who gets to define what is malicious use? What happens if that entity ceases to make those decisions?</p>
394
+ </div>
395
+ </div>
396
+
397
+ <div class="links"><ul class="links"><li class="comment_forbidden first last"><span><a href="/user/login?destination=comment%2Freply%2F66%23comment-form">Login</a> or <a href="/user/register?destination=comment%2Freply%2F66%23comment-form">register</a> to post comments</span></li>
398
+ </ul></div>
399
+ </div>
400
+ </div><form action="/licenses/mit-license.php" accept-charset="UTF-8" method="post" id="comment-controls-1">
401
+ <div><div class="box">
402
+
403
+ <h2>Comment viewing options</h2>
404
+
405
+ <div class="content"><div class="container-inline"><input type="hidden" name="form_build_id" id="form-3e084c2c4b73ed012315ba6496924616" value="form-3e084c2c4b73ed012315ba6496924616" />
406
+ <input type="hidden" name="form_id" id="edit-comment-controls-1" value="comment_controls" />
407
+ <div class="form-item" id="edit-mode-1-wrapper">
408
+ <select name="mode" class="form-select" id="edit-mode-1" ><option value="1">Flat list - collapsed</option><option value="2">Flat list - expanded</option><option value="3">Threaded list - collapsed</option><option value="4" selected="selected">Threaded list - expanded</option></select>
409
+ </div>
410
+ <div class="form-item" id="edit-order-1-wrapper">
411
+ <select name="order" class="form-select" id="edit-order-1" ><option value="1" selected="selected">Date - newest first</option><option value="2">Date - oldest first</option></select>
412
+ </div>
413
+ <div class="form-item" id="edit-comments-per-page-1-wrapper">
414
+ <select name="comments_per_page" class="form-select" id="edit-comments-per-page-1" ><option value="10">10 comments per page</option><option value="30">30 comments per page</option><option value="50" selected="selected">50 comments per page</option><option value="70">70 comments per page</option><option value="90">90 comments per page</option><option value="150">150 comments per page</option><option value="200">200 comments per page</option><option value="250">250 comments per page</option><option value="300">300 comments per page</option></select>
415
+ </div>
416
+ <input type="submit" name="op" id="edit-submit-1" value="Save settings" class="form-submit" />
417
+ </div><div class="description">Select your preferred way to display the comments and click "Save settings" to activate your changes.</div></div>
418
+ </div>
419
+
420
+ </div></form>
421
+ </div>
422
+ </div>
423
+ <div id="footer"><a rel="license" href="http://creativecommons.org/licenses/by/2.5/"><img alt="Creative Commons License" src="http://i.creativecommons.org/l/by/2.5/88x31.png" /></a><br />Opensource.org site content is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/2.5/">Creative Commons Attribution 2.5 License</a>.
424
+
425
+
426
+
427
+ | <a href="../ToS">Terms of Service</a><div id="block-block-7" class="clear-block block block-block">
428
+
429
+
430
+ <div class="content"><script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
431
+ </script>
432
+ <script type="text/javascript">
433
+ _uacct = "UA-3916956-1";
434
+ urchinTracker();
435
+ </script></div>
436
+ </div>
437
+ </div>
438
+ </div></div></div></div> <!-- /.left-corner, /.right-corner, /#squeeze, /#center -->
439
+
440
+
441
+ </div> <!-- /container -->
442
+ </div>
443
+ <!-- /layout -->
444
+
445
+ </body>
446
+ </html>
metadata CHANGED
@@ -1,89 +1,106 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slf4r
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
- - mkristian
7
+ - Kristian Meier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-22 00:00:00 +05:30
12
+ date: 2010-05-09 00:00:00 +05:30
13
13
  default_executable:
14
14
  dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: hoe
17
- type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 1.8.3
24
- version:
25
- description: the main idea is from www.slf4j.org which is to provide a uniform interface for instantiating und using of a logger. but the actual logging is done by some third party logging framework. one idea is to have a logger per class or object (see ). in ruby you would have something like @logger = Slf4r::LoggerFacade.new(self.class) or the convinience module include Slf4r::Logger if the underlying logging framework allows it (like logging or log4r) then you get a logger for each namespace of your class and create a hierachy of loggers. with this you can control the log level for each logger and/or namespace. for example you have a framework A with namespace 'A' then you can set the log level for the logger with name 'A' to debug and get all the debug from the framework, etc. in case you have a framework B which uses log4r internally you can use the 'log4r_adapter' to delegate the logger creation from log4r to slf4r. in this way you have only one place where logging gets configured and controlled.
15
+ - !ruby/object:Gem::Dependency
16
+ name: rspec
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ~>
22
+ - !ruby/object:Gem::Version
23
+ version: 1.3.0
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: logging
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 1.4.1
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: log4r
37
+ type: :development
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 1.1.7
44
+ version:
45
+ description: Slf4r provides a uniform interface for instantiating und using of a logger
26
46
  email:
27
- - m.kristian@web.de
47
+ - m.kristian@web.de
28
48
  executables: []
29
49
 
30
50
  extensions: []
31
51
 
32
- extra_rdoc_files:
33
- - History.txt
34
- - Manifest.txt
35
- - README.txt
52
+ extra_rdoc_files: []
53
+
36
54
  files:
37
- - History.txt
38
- - Manifest.txt
39
- - README.txt
40
- - Rakefile
41
- - lib/log4r_adapter.rb
42
- - lib/logging_adapter.rb
43
- - lib/ruby_logger_adapter.rb
44
- - lib/slf4r.rb
45
- - lib/slf4r/abstract_logger_facade.rb
46
- - lib/slf4r/log4r_logger.rb
47
- - lib/slf4r/logger.rb
48
- - lib/slf4r/logging_logger.rb
49
- - lib/slf4r/noop_logger.rb
50
- - lib/slf4r/ruby_logger.rb
51
- - lib/slf4r/version.rb
52
- - lib/slf4r/wrapped_logger.rb
53
- - load.rb
54
- - spec/log4r_logger_spec.rb
55
- - spec/logger_helper.rb
56
- - spec/logging_logger_spec.rb
57
- - spec/ruby_logger_spec.rb
58
- - spec/spec.opts
59
- - spec/spec_helper.rb
60
- - spec/wrapper_logger_spec.rb
55
+ - licenses/mit-license.php
56
+ - lib/logging_adapter.rb
57
+ - lib/slf4r.rb
58
+ - lib/log4r_adapter.rb
59
+ - lib/ruby_logger_adapter.rb
60
+ - lib/slf4r/logger.rb
61
+ - lib/slf4r/noop_logger.rb
62
+ - lib/slf4r/abstract_logger_facade.rb
63
+ - lib/slf4r/logging_logger.rb
64
+ - lib/slf4r/log4r_logger.rb
65
+ - lib/slf4r/wrapped_logger.rb
66
+ - lib/slf4r/version.rb.errors
67
+ - lib/slf4r/java_logger.rb
68
+ - lib/slf4r/ruby_logger.rb
69
+ - lib/slf4r/version.rb
70
+ - spec/logger_helper.rb
71
+ - spec/spec_helper.rb
72
+ - spec/ruby_logger_spec.rb
73
+ - spec/wrapper_logger_spec.rb
74
+ - spec/spec.opts
75
+ - spec/logging_logger_spec.rb
76
+ - spec/log4r_logger_spec.rb
61
77
  has_rdoc: true
62
- homepage: http://slf4r.rubyforge.com/
78
+ homepage: http://github.com/mkristian/slf4r
79
+ licenses:
80
+ - MIT
63
81
  post_install_message:
64
- rdoc_options:
65
- - --main
66
- - README.txt
82
+ rdoc_options: []
83
+
67
84
  require_paths:
68
- - lib
85
+ - lib
69
86
  required_ruby_version: !ruby/object:Gem::Requirement
70
87
  requirements:
71
- - - ">="
72
- - !ruby/object:Gem::Version
73
- version: "0"
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: "0"
74
91
  version:
75
92
  required_rubygems_version: !ruby/object:Gem::Requirement
76
93
  requirements:
77
- - - ">="
78
- - !ruby/object:Gem::Version
79
- version: "0"
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: "0"
80
97
  version:
81
98
  requirements: []
82
99
 
83
- rubyforge_project: slf4r
84
- rubygems_version: 1.3.1
100
+ rubyforge_project:
101
+ rubygems_version: 1.3.5
85
102
  signing_key:
86
- specification_version: 2
87
- summary: Slf4r provides a uniform interface for instantiating und using of a logger
103
+ specification_version: 3
104
+ summary: Slf4r
88
105
  test_files: []
89
106
 
data/History.txt DELETED
@@ -1,6 +0,0 @@
1
- === 0.1.1 / 2008-12-19
2
-
3
- * fixed printoout of backtrace
4
-
5
- * added log methods for ruby_logger_adapter
6
-
data/Manifest.txt DELETED
@@ -1,24 +0,0 @@
1
- History.txt
2
- Manifest.txt
3
- README.txt
4
- Rakefile
5
- lib/log4r_adapter.rb
6
- lib/logging_adapter.rb
7
- lib/ruby_logger_adapter.rb
8
- lib/slf4r.rb
9
- lib/slf4r/abstract_logger_facade.rb
10
- lib/slf4r/log4r_logger.rb
11
- lib/slf4r/logger.rb
12
- lib/slf4r/logging_logger.rb
13
- lib/slf4r/noop_logger.rb
14
- lib/slf4r/ruby_logger.rb
15
- lib/slf4r/version.rb
16
- lib/slf4r/wrapped_logger.rb
17
- load.rb
18
- spec/log4r_logger_spec.rb
19
- spec/logger_helper.rb
20
- spec/logging_logger_spec.rb
21
- spec/ruby_logger_spec.rb
22
- spec/spec.opts
23
- spec/spec_helper.rb
24
- spec/wrapper_logger_spec.rb
data/README.txt DELETED
@@ -1,98 +0,0 @@
1
- = slf4r
2
-
3
- * FIX (url)
4
-
5
- == DESCRIPTION:
6
-
7
- the main idea is from www.slf4j.org which is to provide a uniform interface for instantiating und using of a logger. but the actual logging is done by some third party logging framework.
8
-
9
- one idea is to have a logger per class or object (see ). in ruby you would have something like
10
-
11
- @logger = Slf4r::LoggerFacade.new(self.class)
12
-
13
- or the convinience module
14
-
15
- include Slf4r::Logger
16
-
17
- if the underlying logging framework allows it (like logging or log4r) then you get a logger for each namespace of your class and create a hierachy of loggers. with this you can control the log level for each logger and/or namespace.
18
-
19
- for example you have a framework A with namespace 'A' then you can set the log level for the logger with name 'A' to debug and get all the debug from the framework, etc.
20
-
21
- in case you have a framework B which uses log4r internally you can use the 'log4r_adapter' to delegate the logger creation from log4r to slf4r. in this way you have only one place where logging gets configured and controlled.
22
-
23
- == FEATURES/PROBLEMS:
24
-
25
- * can replace other logging frameworks via adapters
26
-
27
- * for the actual logging it depends on a third party logging framework
28
-
29
- == SYNOPSIS:
30
-
31
- === using with logging gem
32
-
33
- require 'slf4r/logging_logger'
34
-
35
- Logging.init :debug, :info, :warn, :error
36
-
37
- appender = Logging::Appender.stdout
38
- appender.layout = Logging::Layouts::Pattern.new(:pattern => "%d [%-l] (%c) %m\n")
39
- logger = Logging::Logger.new(:root)
40
- logger.add_appenders(appender)
41
- logger.level = :debug
42
-
43
- === using with ruby logger
44
-
45
- require 'slf4r/ruby_logger'
46
-
47
- === using the log4r adapter
48
-
49
- require 'log4r_adapter'
50
-
51
- === using with rails/merb/datamapper logger
52
-
53
- require 'slf4r/wrapped_logger'
54
-
55
- Slf4r::LoggerFacade4WrappedLogger.logger = framwork_logger
56
-
57
- === getting an instance of a logger
58
-
59
- Slf4r::LoggerFacade.new("Full::Qualified::Class::Name")
60
-
61
- == REQUIREMENTS:
62
-
63
- * logging for slf4r/logging_logger
64
-
65
- * log4r for slf4r/log4r_logger
66
-
67
- == INSTALL:
68
-
69
- * sudo gem install slf4r
70
-
71
- * sudo gem install logging # optional
72
-
73
- * sudo gem install log4r # optional
74
-
75
- == LICENSE:
76
-
77
- (The MIT License)
78
-
79
- Copyright (c) 2009 kristian meier
80
-
81
- Permission is hereby granted, free of charge, to any person obtaining
82
- a copy of this software and associated documentation files (the
83
- 'Software'), to deal in the Software without restriction, including
84
- without limitation the rights to use, copy, modify, merge, publish,
85
- distribute, sublicense, and/or sell copies of the Software, and to
86
- permit persons to whom the Software is furnished to do so, subject to
87
- the following conditions:
88
-
89
- The above copyright notice and this permission notice shall be
90
- included in all copies or substantial portions of the Software.
91
-
92
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
93
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
94
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
95
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
96
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
97
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
98
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile DELETED
@@ -1,37 +0,0 @@
1
- # -*- ruby -*-
2
-
3
- require 'rubygems'
4
- require 'hoe'
5
- require './lib/slf4r/version.rb'
6
-
7
- require 'spec'
8
- require 'spec/rake/spectask'
9
- require 'pathname'
10
-
11
- Hoe.new('slf4r', Slf4r::VERSION) do |p|
12
- p.rubyforge_name = 'slf4r' # if different than lowercase project name
13
- p.summary = 'Slf4r provides a uniform interface for instantiating und using of a logger'
14
- p.url = 'http://slf4r.rubyforge.com/'
15
- p.developer('mkristian', 'm.kristian@web.de')
16
- p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
17
- p.remote_rdoc_dir = '' # Release to root
18
- end
19
-
20
- desc 'Install the package as a gem.'
21
- task :install => [:clean, :package] do
22
- Dir.new('tmp').each do |f|
23
- File.delete('tmp/' + f) if File.file?('tmp/' + f)
24
- end
25
- gem = Dir['pkg/*.gem'].first
26
- sh "gem install --local #{gem} --no-ri --no-rdoc"
27
- end
28
-
29
- desc 'Run specifications'
30
- Spec::Rake::SpecTask.new(:spec) do |t|
31
- if File.exists?('spec/spec.opts')
32
- t.spec_opts << '--options' << 'spec/spec.opts'
33
- end
34
- t.spec_files = Pathname.glob('./spec/**/*_spec.rb')
35
- end
36
-
37
- # vim: syntax=Ruby
data/load.rb DELETED
@@ -1,7 +0,0 @@
1
- require 'rubygems'
2
- require 'slf4j'
3
- # require 'slf4j/simple'
4
-
5
- p java.lang.System.getProperty("java.class.path")
6
- log = SLF4J[ "my.app.logger" ]
7
- log.info "Hello World!"