Creates a log stream for the specified log group.

    :param log_group_name: log group name
    :param log_stream_name: log stream name
    :return:
174819
def create_log_stream(awsclient, log_group_name, log_stream_name):
    
    client_logs = awsclient.get_client('logs')

    response = client_logs.create_log_stream(
        logGroupName=log_group_name,
        logStreamName=log_stream_name
    )
548168
public String createOutputStreamAppender(String name, String pattern, String encoding, Collection<String> loggerNames, 
			String levelStr, boolean recursive, boolean overrideLogLevel) {
		Level level = getLevel(levelStr);
		String encodingToUse = StringUtils.isEmpty(encoding) ? "UTF-8" : encoding;
		PatternLayout layout = PatternLayout.newBuilder()
				.withPattern(StringUtils.isEmpty(pattern) ? DEFAULT_PATTERN : pattern)
				.withCharset(Charset.forName(encodingToUse))
				.build();
		
		String appenderName = StringUtils.isEmpty(name) ? UUID.randomUUID().toString() : name;
		
		AdminToolLog4j2OutputStream baos = new AdminToolLog4j2OutputStream(4096, encodingToUse);
		outputStreams.put(appenderName, baos);
		
		OutputStreamAppender appender = OutputStreamAppender.newBuilder()
				.setName(appenderName)
				.setTarget(baos)
				.setLayout(layout)
				.setFollow(false)
				.build();
		
		appender.start();
		
		final LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
		final Configuration config = ctx.getConfiguration();
		config.addAppender(appender);
		
		Collection<String> parentLoggerNames = getParentLoggerNames();
		
		Map<String, LoggerConfig> configs = getRecursiveLoggerConfigs(loggerNames, recursive, config);
		configs.entrySet().forEach(configEntry ->{
			configEntry.getValue().addAppender(appender, level, null);
			if (overrideLogLevel) {
				baos.addOriginalLevel(configEntry.getKey(), configEntry.getValue().getLevel());
				changeLogger(configEntry.getKey(), level, parentLoggerNames.contains(configEntry.getKey()));
			}
		});
		
		ctx.updateLoggers();
		return appenderName;
	}
1192063
def gen_logger(name: str, log_level: int=logging.INFO) -> logging.Logger:
    
    logger = logging.getLogger(name)
    logger.setLevel(log_level)
    shandler: logging.StreamHandler = logging.StreamHandler(sys.stdout)
    fmt: str = '\033[1;32m%(levelname)-5s %(module)s:%(funcName)s():'
    fmt += '%(lineno)d %(asctime)s\033[0m| %(message)s'
    shandler.setFormatter(logging.Formatter(fmt))
    logger.addHandler(shandler)
    return logger
708092
def logStream(fileHandle, shortName, printFunction=logger.info):
    
    printFunction("Reporting file: %s" % shortName)
    line = fileHandle.readline()
    while line != '':
        if line[-1] == '\n':
            line = line[:-1]
        printFunction("%s:\t%s" % (shortName, line))
        line = fileHandle.readline()
    fileHandle.close()
1090915
def get_log_events(awsclient, log_group_name, log_stream_name, start_ts=None):
    
    client_logs = awsclient.get_client('logs')

    request = {
        'logGroupName': log_group_name,
        'logStreamName': log_stream_name
    }
    if start_ts:
        request['startTime'] = start_ts

    # TODO exhaust the events!
    # TODO use all_pages !
    response = client_logs.get_log_events(**request)

    if 'events' in response and response['events']:
        return [{'timestamp': e['timestamp'], 'message': e['message']}
                for e in response['events']]
356971
def create_logger_for_context(self, logger_name, context):
        

        if self._is_instance_of(context, 'AutoLoadCommandContext'):
            reservation_id = 'Autoload'
            handler_name = context.resource.name
        elif self._is_instance_of(context, 'UnreservedResourceCommandContext'):
            reservation_id = 'DeleteArtifacts'
            handler_name = context.resource.name
        else:
            reservation_id = self._get_reservation_id(context)

            if self._is_instance_of(context, 'ResourceCommandContext'):
                handler_name = context.resource.name
            elif self._is_instance_of(context, 'ResourceRemoteCommandContext'):
                handler_name = context.remote_endpoints[0].name
            else:
                raise Exception(ContextBasedLoggerFactory.UNSUPPORTED_CONTEXT_PROVIDED, context)

        logger = get_qs_logger(log_file_prefix=handler_name,
                               log_group=reservation_id,
                               log_category=logger_name)
        return logger
927755
def get_logger(name, level=None, fmt=':%(lineno)d: %(message)s'):
        
        if name not in Logger.loggers:
            if Logger.level is None and level is None:
                Logger.level = level = logging.ERROR
            elif Logger.level is None:
                Logger.level = level
            elif level is None:
                level = Logger.level
            logger = logging.getLogger(name)
            logger_handler = logging.StreamHandler()
            logger_handler.setFormatter(LoggingFormatter(fmt=name + fmt))
            logger.addHandler(logger_handler)
            logger.setLevel(level)
            Logger.loggers[name] = logger
        return Logger.loggers[name]
710907
def get_group(self, group_name):
        
        response = self.client.get_group(GroupName=group_name,
                                         UserPoolId=self.user_pool_id)
        return self.get_group_obj(response.get('Group'))
318242
def do_logStream(self,args):
        """"""
        parser = CommandArgumentParser("logStream")
        parser.add_argument(dest='logStream',help='logStream index.');
        args = vars(parser.parse_args(args))

        print "loading log stream {}".format(args['logStream'])
        index = int(args['logStream'])
        logStream = self.logStreams[index]

        print "logStream:{}".format(logStream)
        self.childLoop(AwsLogStream.AwsLogStream(logStream,self))
1123344
def libvlc_log_set_file(p_instance, stream):
    '''
    '''
    f = _Cfunctions.get('libvlc_log_set_file', None) or \
        _Cfunction('libvlc_log_set_file', ((1,), (1,),), None,
                    None, Instance, FILE_ptr)
    return f(p_instance, stream)
641051
def create_logger(name, formatter=None, handler=None, level=None):
    
    logger = logging.getLogger(name)

    #: remove existing handlers
    logger.handlers = []

    #: use a standard out handler
    if handler is None:
        handler = logging.StreamHandler(sys.stdout)

    #: set the formatter when a formatter is given
    if formatter is not None:
        handler.setFormatter(formatter)

    #: set DEBUG level if no level is specified
    if level is None:
        level = logging.DEBUG

    handler.setLevel(level)
    logger.setLevel(level)
    logger.addHandler(handler)
    return logger
74377
def log_to_stream(stream=sys.stderr, level=logging.NOTSET,
                  fmt=logging.BASIC_FORMAT):
    
    fmt = Formatter(fmt)
    handler = StreamHandler()
    handler.setFormatter(fmt)
    handler.setLevel(level)

    log.addHandler(handler)
182433
private Logger createLoggerInstance(String loggerName) throws Exception
    {
        Class loggerClass = getConfiguration().getLoggerClass();
        Logger log = (Logger) ClassHelper.newInstance(loggerClass, String.class, loggerName);
        log.configure(getConfiguration());
        return log;
    }
51634
private static group_stream_response newGroupStream(Stream<Map.Entry<DateTime, TimeSeriesValue>> tsc, int fetch) {
        final BufferedIterator<Map.Entry<DateTime, TimeSeriesValue>> iter = new BufferedIterator<>(tsc.iterator(), GROUP_STREAM_QUEUE_SIZE);
        final long idx = GROUP_STREAM_ITERS_ALLOC.getAndIncrement();
        final IteratorAndCookie<Map.Entry<DateTime, TimeSeriesValue>> iterAndCookie = new IteratorAndCookie<>(iter);
        GROUP_STREAM_ITERS.put(idx, iterAndCookie);

        final List<Map.Entry<DateTime, TimeSeriesValue>> result = fetchFromIter(iter, fetch, MAX_GROUP_STREAM_FETCH);
        EncDec.NewIterResponse<Map.Entry<DateTime, TimeSeriesValue>> responseObj
                = new EncDec.NewIterResponse<>(idx, result, iter.atEnd(), iterAndCookie.getCookie());
        LOG.log(Level.FINE, "responseObj = {0}", responseObj);
        return EncDec.encodeStreamGroupResponse(responseObj);
    }
20812
def xgroup_create(self, stream, group_name, latest_id='$', mkstream=False):
        """"""
        args = [b'CREATE', stream, group_name, latest_id]
        if mkstream:
            args.append(b'MKSTREAM')
        fut = self.execute(b'XGROUP', *args)
        return wait_ok(fut)
174354
def filter_log_events(awsclient, log_group_name, start_ts, end_ts=None):
    
    client_logs = awsclient.get_client('logs')
    # TODO use all_pages instead!
    logs = []
    next_token = None
    while True:
        request = {
            'logGroupName': log_group_name,
            'startTime': start_ts
        }
        if end_ts:
            request['endTime'] = end_ts
        if next_token:
            request['nextToken'] = next_token
        response = client_logs.filter_log_events(**request)
        logs.extend(
            [{'timestamp': e['timestamp'], 'message': e['message']}
             for e in response['events']]
        )
        if 'nextToken' not in response:
            break
        next_token = response['nextToken']
    return logs
530975
def create_group(self, name):
        
        self.service.create_group(
            name, self.url_prefix, self.auth, self.session,
            self.session_send_opts)