def __test_logging(): fl = create_file_logger("test_file_logger", 'logtest.out') sl = create_stream_logger("test_stream_logger") nl = create_null_logger("test_null_logger") fl.info("This should go to the file") sl.info("This should go to the standard output") nl.info("This should go nowhere")
parser.add_argument('-i', '--identifier', default="Identifier", help='Name of an Identifier column in the input spreadsheet. ') parser.add_argument('-d', '--download_cache', default="./data", help='Path to a directory in which to chache dowloads (defaults to ./data)') parser.add_argument('-t', '--title', default="Title", help='Name of a Title column in the input spreadsheet. ') parser.add_argument('-p', '--public', action='store_true', help='Make items public') parser.add_argument('-f', '--featured', action='store_true', help='Make items featured') parser.add_argument('-c', '--create_collections', action='store_true', help='Auto-create missing collections') parser.add_argument('-e', '--create_elements', action='store_true', help='Auto-create missing element types') parser.add_argument('-y', '--create_item_types', action='store_true', help='Auto-create missing Item Types') parser.add_argument('-l', '--logfile', default=None, help='send log messages to the named logfile') parser.add_argument('-q', '--quietly', action='store_true', help='Only log errors and warnings not the constant stream of info') args = vars(parser.parse_args()) if args['logfile'] == None: logger = create_stream_logger('xlxx2omeka', stdout) else: logger = create_file_logger('xlsx2omeka', args['logfile'], mode='w') config = get_omeka_config() endpoint = args['api_url'] if args['api_url'] <> None else config['api_url'] apikey = args['key'] if args['api_url'] <> None else config['key'] omeka_client = OmekaClient(endpoint.encode("utf-8"), logger, apikey) inputfile = args['inputfile'] identifier_column = args['identifier'] title_column = args['title'] data_dir = args['download_cache'] if args["quietly"]: logger.setLevel(30) #Auto-map to elements from these sets