Module: MasterView
- Defined in:
- lib/masterview.rb,
lib/masterview/io.rb,
lib/masterview/parser.rb,
lib/masterview/analyzer.rb,
lib/masterview/exceptions.rb,
lib/masterview/initializer.rb,
lib/masterview/directives/if.rb,
lib/masterview/template_spec.rb,
lib/masterview/extras/watcher.rb,
lib/masterview/filter_helpers.rb,
lib/masterview/parser_helpers.rb,
lib/masterview/directives/attr.rb,
lib/masterview/directives/else.rb,
lib/masterview/directives/eval.rb,
lib/masterview/directives/form.rb,
lib/masterview/masterview_info.rb,
lib/masterview/runtime_helpers.rb,
lib/masterview/directives/block.rb,
lib/masterview/directives/elsif.rb,
lib/masterview/extras/auto_copy.rb,
lib/masterview/keyword_expander.rb,
lib/masterview/directive_helpers.rb,
lib/masterview/directives/import.rb,
lib/masterview/directives/select.rb,
lib/masterview/directive_metadata.rb,
lib/masterview/directive_registry.rb,
lib/masterview/directives/content.rb,
lib/masterview/directives/preview.rb,
lib/masterview/directives/replace.rb,
lib/masterview/extras/init_logger.rb,
lib/masterview/masterview_version.rb,
lib/masterview/directive_load_path.rb,
lib/masterview/directives/omit_tag.rb,
lib/masterview/mtime_tracking_hash.rb,
lib/masterview/directives/check_box.rb,
lib/masterview/directives/image_tag.rb,
lib/masterview/directives/text_area.rb,
lib/masterview/plugin_load_tracking.rb,
lib/masterview/case_insensitive_hash.rb,
lib/masterview/directives/text_field.rb,
lib/masterview/directives/form_remote.rb,
lib/masterview/directives/hidden_field.rb,
lib/masterview/directives/radio_button.rb,
lib/masterview/extras/admin_auth_mixin.rb,
lib/masterview/extras/sample_templates.rb,
lib/masterview/directives/import_render.rb,
lib/masterview/deprecated/directive_base.rb,
lib/masterview/directives/password_field.rb,
lib/masterview/rails_ext/short_path_calc.rb,
lib/masterview/directives/stylesheet_link.rb,
lib/masterview/directives/link_to_function.rb,
lib/masterview/directives/collection_select.rb,
lib/masterview/directives/global_inline_erb.rb,
lib/masterview/directives/javascript_include.rb,
lib/masterview/directives/insert_generated_comment.rb
Overview
– Copyright © 2006 Jeff Barczewski
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ++
MasterView initialization utility to install a logger in MasterView::Log
.
The MasterView logger is used by the MasterView template engine and directive implementations to record debug, warning, and error messages.
– Need to do this in separate init file in order to do the Log4r include for mixing into the MasterView module. Can’t just do MasterView.include Log4r in Initializer#initialize_logger, unfortunately. ++
Defined Under Namespace
Modules: Admin, Analyzer, ConfigInfoHelpers, DirectiveHelpers, DirectiveLoadPath, DirectiveMetadata, Directives, DirectivesInfo, EscapeErbHelper, FeaturesInfo, Info, MIO, ParserHelpers, PluginLoadTracking, RailsExt, RuntimeHelpers, TemplateProcessing, TidyHelper, VERSION Classes: AutoCopy, CaseInsensitiveHash, Configuration, DirectiveBaseOld, DirectiveRegistry, Initializer, InvalidDirectivePathError, InvalidIOPathError, InvalidPathError, KeywordExpander, MTimeTrackingHash, Parser, SampleTemplates, TemplateSpec, TemplateWatcher
Constant Summary collapse
- Log =
:nodoc:
Logger.new STDOUT
- LogLevels =
:nodoc:
{}
Class Method Summary collapse
-
.log_level(flavor = :name) ⇒ Object
Answer the current logging severity level of the MasterView::Log.
-
.log_level=(level) ⇒ Object
Set the logging severity level for the MasterView::Log.
-
.register_directive(directive_class) ⇒ Object
Register a directive implementation.
-
.set_log_level(level) ⇒ Object
Set the logging severity level for the MasterView::Log.
Class Method Details
.log_level(flavor = :name) ⇒ Object
Answer the current logging severity level of the MasterView::Log. By default, answers the name of the logging level. Request :index flavor to get the logger’s internal index value
71 72 73 74 75 76 77 |
# File 'lib/masterview/extras/init_logger.rb', line 71 def self.log_level( flavor=:name ) lindex = Log.level return lindex if flavor == :index lname = LogLevels.index(lindex) # nil if unknown name - ok or should we complain? lname = lname.to_sym if lname lname end |
.log_level=(level) ⇒ Object
Set the logging severity level for the MasterView::Log
80 81 82 |
# File 'lib/masterview/extras/init_logger.rb', line 80 def self.log_level= level set_log_level(level) end |
.register_directive(directive_class) ⇒ Object
Register a directive implementation.
Registration is handled automatically for directives implemented as subclasses of MasterView::DirectiveBase, the usual technique, or by including the PluginLoadTracking module in a directive implementation class.
Directive registration ordinarily occurs during MasterView initialization, when directive classes from the configured directive_load_path
directories are automatically loaded and registered with the template engine.
356 357 358 |
# File 'lib/masterview/directive_registry.rb', line 356 def self.register_directive(directive_class) DirectiveRegistry.current.register_directive(directive_class) end |
.set_log_level(level) ⇒ Object
Set the logging severity level for the MasterView::Log
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/masterview/extras/init_logger.rb', line 85 def self.set_log_level(level) #TBD: justify use case and test before enabling polymorphic parm cleverness if level.kind_of? Integer #TODO: ensure a valid level for this logger?? #Log.level = level Log.error "Not supported: log_level='#{level}' (use string or symbol form of level name)" return end #assert (level.kind_of? String) || (level.kind_of? Symbol) lname = level.to_s # stringify per internal rep if LogLevels.has_key?(lname) Log.level = LogLevels[lname] else Log.error "Undefined log level='#{level}' for #{Log.class.name} logger" end end |