class GoogleStorageLoggingFeature implements Logging, DistributionLogging {

    @Override
    public LoggingConfiguration getConfiguration(final Path file) throws BackgroundException {
        final Path bucket = containerService.getContainer(file);
        if(bucket.isRoot()) {
            return LoggingConfiguration.empty();
        }
        try {
            final Bucket.Logging status = session.getClient().buckets().get(bucket.getName()).execute().getLogging();
            if(null == status) {
                return LoggingConfiguration.empty();
            }
            final LoggingConfiguration configuration = new LoggingConfiguration(
                status.getLogObjectPrefix() != null, status.getLogBucket());
            try {
                configuration.setContainers(new GoogleStorageBucketListService(session).list(
                    new Path(String.valueOf(Path.DELIMITER), EnumSet.of(Path.Type.volume, Path.Type.directory)),
                    new DisabledListProgressListener()).toList());
            }
            catch(AccessDeniedException | InteroperabilityException e) {
                log.warn(String.format("Failure listing buckets. %s", e.getMessage()));
            }
            return configuration;
        }
        catch(IOException e) {
            try {
                throw new GoogleStorageExceptionMappingService().map("Failure to read attributes of {0}", e, bucket);
            }
            catch(AccessDeniedException | InteroperabilityException l) {
                log.warn(String.format("Missing permission to read logging configuration for %s %s", bucket.getName(), e.getMessage()));
                return LoggingConfiguration.empty();
            }
        }
    }

    public  GoogleStorageLoggingFeature(final GoogleStorageSession session);

}