Can a function tell if an argument is in an enum or otherwise get the base type?

I have a generic function that logs some data into a binary file for a user. Naturally, I need to know how many bits the type needs. This is easy to do for most types. However, I’m unclear on what to do when the user passes in an enum. I expect that I’ll need to call Base.Enums.basetype on the data in order to determine the bits necessary for logging it, but without knowing if it’s an enum already, how would I know I need to call that? I think I need an isenum function or something.

For most other types, I call eltype to return something like Float64, Int8, etc., but eltype returns Any for an enum.

Any ideas?

Oops, this is easy. I missed the existence of the Enum abstract type. I found it via macroexpand on an @enum macro. What I need is:

typeof(argument) <: Enum

or via multiple dispatch:

function log(..., data::T) where {T <: Enum}
   log(..., Base.Enums.basetype(T)(data))

to get down to the primitive underlying the enum.