Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 1 | /** |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 2 | * Copyright 2012, Big Switch Networks, Inc. |
| 3 | * Originally created by David Erickson, Stanford University |
| 4 | * |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 6 | * not use this file except in compliance with the License. You may obtain |
| 7 | * a copy of the License at |
| 8 | * |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | * |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 14 | * License for the specific language governing permissions and limitations |
| 15 | * under the License. |
| 16 | **/ |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 17 | |
| 18 | package net.floodlightcontroller.core.annotations; |
| 19 | |
| 20 | import java.lang.annotation.ElementType; |
| 21 | import java.lang.annotation.Target; |
| 22 | |
| 23 | /** |
| 24 | * Annotation used to document log messages. This can be used to generate |
| 25 | * documentation on syslog output. |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 26 | * |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 27 | * @author readams |
| 28 | */ |
| 29 | @Target({ElementType.TYPE, ElementType.METHOD}) |
| 30 | public @interface LogMessageDoc { |
| 31 | public static final String NO_ACTION = "No action is required."; |
| 32 | public static final String UNKNOWN_ERROR = "An unknown error occured"; |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 33 | public static final String GENERIC_ACTION = |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 34 | "Examine the returned error or exception and take " + |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 35 | "appropriate action."; |
| 36 | public static final String CHECK_SWITCH = |
| 37 | "Check the health of the indicated switch. " + |
| 38 | "Test and troubleshoot IP connectivity."; |
| 39 | public static final String CHECK_CONTROLLER = |
| 40 | "Verify controller system health, CPU usage, and memory. " + |
| 41 | "Rebooting the controller node may help if the controller " + |
| 42 | "node is in a distressed state."; |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 43 | public static final String REPORT_CONTROLLER_BUG = |
| 44 | "This is likely a defect in the controller. Please report this " + |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 45 | "issue. Restarting the controller or switch may help to " + |
| 46 | "alleviate."; |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 47 | public static final String REPORT_SWITCH_BUG = |
| 48 | "This is likely a defect in the switch. Please report this " + |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 49 | "issue. Restarting the controller or switch may help to " + |
| 50 | "alleviate."; |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 51 | |
| 52 | /** |
| 53 | * The log level for the log message |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 54 | * |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 55 | * @return the log level as a tring |
| 56 | */ |
| 57 | String level() default "INFO"; |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 58 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 59 | /** |
| 60 | * The message that will be printed |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 61 | * |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 62 | * @return the message |
| 63 | */ |
| 64 | String message() default UNKNOWN_ERROR; |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 65 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 66 | /** |
| 67 | * An explanation of the meaning of the log message |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 68 | * |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 69 | * @return the explanation |
| 70 | */ |
| 71 | String explanation() default UNKNOWN_ERROR; |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 72 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 73 | /** |
| 74 | * The recommendated action associated with the log message |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 75 | * |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 76 | * @return the recommendation |
| 77 | */ |
| 78 | String recommendation() default NO_ACTION; |
| 79 | } |