}
 
 static int
-bpf_object__load_progs(struct bpf_object *obj)
+bpf_object__load_progs(struct bpf_object *obj, int log_level)
 {
        size_t i;
        int err;
        for (i = 0; i < obj->nr_programs; i++) {
                if (bpf_program__is_function_storage(&obj->programs[i], obj))
                        continue;
+               obj->programs[i].log_level = log_level;
                err = bpf_program__load(&obj->programs[i],
                                        obj->license,
                                        obj->kern_version);
        return 0;
 }
 
-int bpf_object__load(struct bpf_object *obj)
+int bpf_object__load_xattr(struct bpf_object_load_attr *attr)
 {
+       struct bpf_object *obj;
        int err;
 
+       if (!attr)
+               return -EINVAL;
+       obj = attr->obj;
        if (!obj)
                return -EINVAL;
 
 
        CHECK_ERR(bpf_object__create_maps(obj), err, out);
        CHECK_ERR(bpf_object__relocate(obj), err, out);
-       CHECK_ERR(bpf_object__load_progs(obj), err, out);
+       CHECK_ERR(bpf_object__load_progs(obj, attr->log_level), err, out);
 
        return 0;
 out:
        return err;
 }
 
+int bpf_object__load(struct bpf_object *obj)
+{
+       struct bpf_object_load_attr attr = {
+               .obj = obj,
+       };
+
+       return bpf_object__load_xattr(&attr);
+}
+
 static int check_path(const char *path)
 {
        char *cp, errmsg[STRERR_BUFSIZE];
 
 LIBBPF_API int bpf_object__pin(struct bpf_object *object, const char *path);
 LIBBPF_API void bpf_object__close(struct bpf_object *object);
 
+struct bpf_object_load_attr {
+       struct bpf_object *obj;
+       int log_level;
+};
+
 /* Load/unload object into/from kernel */
 LIBBPF_API int bpf_object__load(struct bpf_object *obj);
+LIBBPF_API int bpf_object__load_xattr(struct bpf_object_load_attr *attr);
 LIBBPF_API int bpf_object__unload(struct bpf_object *obj);
 LIBBPF_API const char *bpf_object__name(struct bpf_object *obj);
 LIBBPF_API unsigned int bpf_object__kversion(struct bpf_object *obj);