< prev index next >

src/share/vm/logging/logTagSet.cpp

Print this page
rev 12117 : 8146009:


   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 #include "precompiled.hpp"
  25 #include "logging/logDecorations.hpp"

  26 #include "logging/logLevel.hpp"
  27 #include "logging/logMessageBuffer.hpp"
  28 #include "logging/logOutput.hpp"
  29 #include "logging/logTag.hpp"
  30 #include "logging/logTagSet.hpp"
  31 #include "logging/logTagSetDescriptions.hpp"
  32 #include "memory/allocation.inline.hpp"
  33 #include "utilities/ostream.hpp"
  34 
  35 LogTagSet*  LogTagSet::_list      = NULL;
  36 size_t      LogTagSet::_ntagsets  = 0;
  37 
  38 // This constructor is called only during static initialization.
  39 // See the declaration in logTagSet.hpp for more information.
  40 LogTagSet::LogTagSet(PrefixWriter prefix_writer, LogTagType t0, LogTagType t1, LogTagType t2, LogTagType t3, LogTagType t4)
  41     : _next(_list), _write_prefix(prefix_writer) {
  42   _tag[0] = t0;
  43   _tag[1] = t1;
  44   _tag[2] = t2;
  45   _tag[3] = t3;
  46   _tag[4] = t4;
  47   for (_ntags = 0; _ntags < LogTag::MaxTags && _tag[_ntags] != LogTag::__NO_TAG; _ntags++) {
  48   }
  49   _list = this;
  50   _ntagsets++;
  51 
  52   // Set the default output to warning and error level for all new tagsets.
  53   _output_list.set_output_level(LogOutput::Stdout, LogLevel::Default);
  54 }
  55 
  56 void LogTagSet::update_decorators(const LogDecorators& decorator) {
  57   LogDecorators new_decorators = decorator;
  58   for (LogOutputList::Iterator it = _output_list.iterator(); it != _output_list.end(); it++) {
  59     new_decorators.combine_with((*it)->decorators());
  60   }
  61   _decorators = new_decorators;
  62 }
  63 
  64 bool LogTagSet::has_output(const LogOutput* output) {
  65   for (LogOutputList::Iterator it = _output_list.iterator(); it != _output_list.end(); it++) {
  66     if (*it == output) {
  67       return true;
  68     }
  69   }
  70   return false;
  71 }
  72 
  73 void LogTagSet::log(LogLevelType level, const char* msg) {




   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 #include "precompiled.hpp"
  25 #include "logging/logDecorations.hpp"
  26 #include "logging/logFileStreamOutput.hpp"
  27 #include "logging/logLevel.hpp"
  28 #include "logging/logMessageBuffer.hpp"
  29 #include "logging/logOutput.hpp"
  30 #include "logging/logTag.hpp"
  31 #include "logging/logTagSet.hpp"
  32 #include "logging/logTagSetDescriptions.hpp"
  33 #include "memory/allocation.inline.hpp"
  34 #include "utilities/ostream.hpp"
  35 
  36 LogTagSet*  LogTagSet::_list      = NULL;
  37 size_t      LogTagSet::_ntagsets  = 0;
  38 
  39 // This constructor is called only during static initialization.
  40 // See the declaration in logTagSet.hpp for more information.
  41 LogTagSet::LogTagSet(PrefixWriter prefix_writer, LogTagType t0, LogTagType t1, LogTagType t2, LogTagType t3, LogTagType t4)
  42     : _next(_list), _write_prefix(prefix_writer) {
  43   _tag[0] = t0;
  44   _tag[1] = t1;
  45   _tag[2] = t2;
  46   _tag[3] = t3;
  47   _tag[4] = t4;
  48   for (_ntags = 0; _ntags < LogTag::MaxTags && _tag[_ntags] != LogTag::__NO_TAG; _ntags++) {
  49   }
  50   _list = this;
  51   _ntagsets++;
  52 
  53   // Set the default output to warning and error level for all new tagsets.
  54   _output_list.set_output_level(&StdoutLog, LogLevel::Default);
  55 }
  56 
  57 void LogTagSet::update_decorators(const LogDecorators& decorator) {
  58   LogDecorators new_decorators = decorator;
  59   for (LogOutputList::Iterator it = _output_list.iterator(); it != _output_list.end(); it++) {
  60     new_decorators.combine_with((*it)->decorators());
  61   }
  62   _decorators = new_decorators;
  63 }
  64 
  65 bool LogTagSet::has_output(const LogOutput* output) {
  66   for (LogOutputList::Iterator it = _output_list.iterator(); it != _output_list.end(); it++) {
  67     if (*it == output) {
  68       return true;
  69     }
  70   }
  71   return false;
  72 }
  73 
  74 void LogTagSet::log(LogLevelType level, const char* msg) {


< prev index next >