diff --git a/exiv.go b/exiv.go index 7f6a6aa..b1be378 100644 --- a/exiv.go +++ b/exiv.go @@ -105,6 +105,21 @@ func OpenBytes(input []byte) (*Image, error) { return makeImage(cimg, bytesArrayPtr), nil } +type LogMsgLevel int + +const ( + LogMsgDebug LogMsgLevel = 0 + LogMsgInfo = 1 + LogMsgWarn = 2 + LogMsgError = 3 + LogMsgMute = 4 +) + +// SetLogMsgLevel Set the log level (outputs to stderr) +func SetLogMsgLevel(level LogMsgLevel) { + C.exiv2_log_msg_set_level(C.int(level)) +} + // ReadMetadata reads the metadata of an Image func (i *Image) ReadMetadata() error { var cerr *C.Exiv2Error diff --git a/helper.cpp b/helper.cpp index 9d8c30b..46ee501 100644 --- a/helper.cpp +++ b/helper.cpp @@ -416,6 +416,15 @@ const char* exiv2_exif_datum_to_string(const Exiv2ExifDatum *datum) DEFINE_FREE_FUNCTION(exiv2_exif_datum, Exiv2ExifDatum*); +// LOG LEVEL + +void +exiv2_log_msg_set_level(const int level) +{ + Exiv2::LogMsg::Level cpplevel = static_cast(level); + Exiv2::LogMsg::setLevel(cpplevel); +} + // ERRORS int diff --git a/helper.h b/helper.h index 36e9343..be65621 100644 --- a/helper.h +++ b/helper.h @@ -64,6 +64,8 @@ Exiv2ExifDatum* exiv2_exif_datum_iterator_next(Exiv2ExifDatumIterator *iter); const unsigned char* exiv2_image_icc_profile(Exiv2Image *img); long exiv2_image_icc_profile_size(Exiv2Image *img); +void exiv2_log_msg_set_level(const int level); + int exiv2_error_code(const Exiv2Error *e); const char *exiv2_error_what(const Exiv2Error *e); void exiv2_error_free(Exiv2Error *e);