author | mlarsson |
Fri, 27 Nov 2015 12:37:38 +0100 | |
changeset 34316 | 4d876653d940 |
parent 33097 | 96e348cb0442 |
child 35852 | 15ca44d4ae0c |
permissions | -rw-r--r-- |
33097 | 1 |
/* |
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
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 |
#ifndef SHARE_VM_LOGGING_LOGTAGLEVELEXPRESSION_HPP |
|
25 |
#define SHARE_VM_LOGGING_LOGTAGLEVELEXPRESSION_HPP |
|
26 |
||
34316
4d876653d940
8142952: Unified Logging framework does not allow multiple -Xlog: arguments.
mlarsson
parents:
33097
diff
changeset
|
27 |
#include "logging/logConfiguration.hpp" |
33097 | 28 |
#include "logging/logLevel.hpp" |
29 |
#include "logging/logTag.hpp" |
|
30 |
#include "memory/allocation.hpp" |
|
31 |
#include "utilities/debug.hpp" |
|
32 |
#include "utilities/globalDefinitions.hpp" |
|
33 |
||
34 |
class LogTagSet; |
|
35 |
||
36 |
// Class used to temporary encode a 'what'-expression during log configuration. |
|
37 |
// Consists of a combination of tags and levels, e.g. "tag1+tag2=level1,tag3*=level2". |
|
38 |
class LogTagLevelExpression : public StackObj { |
|
34316
4d876653d940
8142952: Unified Logging framework does not allow multiple -Xlog: arguments.
mlarsson
parents:
33097
diff
changeset
|
39 |
friend void LogConfiguration::configure_stdout(LogLevelType, bool, ...); |
33097 | 40 |
private: |
41 |
static const size_t MaxCombinations = 32; |
|
42 |
static const char* DefaultExpressionString; |
|
43 |
||
44 |
size_t _ntags, _ncombinations; |
|
45 |
LogTagType _tags[MaxCombinations][LogTag::MaxTags]; |
|
46 |
LogLevelType _level[MaxCombinations]; |
|
47 |
bool _allow_other_tags[MaxCombinations]; |
|
48 |
||
49 |
void new_combination() { |
|
50 |
_ncombinations++; |
|
51 |
_ntags = 0; |
|
52 |
} |
|
53 |
||
54 |
void add_tag(LogTagType tag) { |
|
55 |
assert(_ntags < LogTag::MaxTags, "Can't have more tags than MaxTags!"); |
|
56 |
_tags[_ncombinations][_ntags++] = tag; |
|
57 |
} |
|
58 |
||
59 |
void set_level(LogLevelType level) { |
|
60 |
_level[_ncombinations] = level; |
|
61 |
} |
|
62 |
||
63 |
void set_allow_other_tags() { |
|
64 |
_allow_other_tags[_ncombinations] = true; |
|
65 |
} |
|
66 |
||
67 |
void clear(); |
|
68 |
||
69 |
public: |
|
34316
4d876653d940
8142952: Unified Logging framework does not allow multiple -Xlog: arguments.
mlarsson
parents:
33097
diff
changeset
|
70 |
LogTagLevelExpression() : _ntags(0), _ncombinations(0) { |
33097 | 71 |
} |
72 |
||
73 |
bool parse(const char* str, outputStream* errstream = NULL); |
|
74 |
LogLevelType level_for(const LogTagSet& ts) const; |
|
75 |
}; |
|
76 |
||
77 |
#endif // SHARE_VM_LOGGING_LOGTAGLEVELEXPRESSION_HPP |