001package votorola.s.line; // Copyright 2007-2008, 2011, Michael Allan. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Votorola Software"), to deal in the Votorola Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicence, and/or sell copies of the Votorola Software, and to permit persons to whom the Votorola Software is furnished to do so, subject to the following conditions: The preceding copyright notice and this permission notice shall be included in all copies or substantial portions of the Votorola Software. THE VOTOROLA 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 VOTOROLA SOFTWARE OR THE USE OR OTHER DEALINGS IN THE VOTOROLA SOFTWARE. 002 003import java.util.*; 004import votorola.a.response.line.*; 005import votorola.g.lang.*; 006import votorola.g.logging.*; 007import votorola.g.option.*; 008 009 010/** Main class of the executable <code>volog</code> - a test tool to log messages at all 011 * logging levels. 012 * 013 * @see <a href='../../../../../s/manual.xht#line-volog' target='_top'>volog</a> 014 */ 015public @ThreadSafe final class VOLog 016{ 017 018 private VOLog() {} 019 020 021 022 /** Executes from the command line. 023 * 024 * @param argv command line argument array 025 */ 026 public static void main( final String[] argv ) 027 { 028 LoggerX.i(VOLog.class).info( "volog is running with arguments " + Arrays.toString( argv )); 029 final Map<String,Option> optionMap = CommandLine.compileBaseOptions(); 030 final int aFirstNonOption = GetoptX.parse( "volog", argv, optionMap ); 031 if( optionMap.get("help").hasOccured() ) 032 { 033 System.out.print( 034 "Usage: volog\n" + 035 "Log test messages at all logging levels.\n" ); 036 return; 037 } 038 039 if( aFirstNonOption < argv.length ) 040 { 041 System.err.println( GetoptX.createUnexpectedArgWarning( 042 "volog", argv[aFirstNonOption] )); 043 System.err.println( GetoptX.createHelpPrompt( "volog" )); 044 System.exit( 1 ); 045 } 046 LoggerX.test( LoggerX.i( VOLog.class )); 047 } 048 049 050 051}