set the default log type if not set

This commit is contained in:
hyunghwan.chung 2019-01-28 17:42:04 +00:00
parent c13fe9b769
commit 0017564a69

View File

@ -670,6 +670,12 @@ moo_ooi_t moo_logbfmt (moo_t* moo, moo_bitmask_t mask, const moo_bch_t* fmt, ...
* it'll get turned back on */ * it'll get turned back on */
mask |= (moo->log.default_type_mask & MOO_LOG_ALL_TYPES); mask |= (moo->log.default_type_mask & MOO_LOG_ALL_TYPES);
} }
else if (!(mask & MOO_LOG_ALL_TYPES))
{
/* no type is set in the given mask and no default type is set.
* make it UNTYPED. */
mask |= MOO_LOG_UNTYPED;
}
fo.mask = mask; fo.mask = mask;
fo.putch = put_ooch; fo.putch = put_ooch;
@ -698,6 +704,10 @@ moo_ooi_t moo_logufmt (moo_t* moo, moo_bitmask_t mask, const moo_uch_t* fmt, ...
mask &= ~MOO_LOG_UNTYPED; mask &= ~MOO_LOG_UNTYPED;
mask |= (moo->log.default_type_mask & MOO_LOG_ALL_TYPES); mask |= (moo->log.default_type_mask & MOO_LOG_ALL_TYPES);
} }
else if (!(mask & MOO_LOG_ALL_TYPES))
{
mask |= MOO_LOG_UNTYPED;
}
fo.mask = mask; fo.mask = mask;
fo.putch = put_ooch; fo.putch = put_ooch;