| 1 |
|
| #pragma once |
| 2 |
|
| #include <xs.h> |
| 3 |
|
| #include <panda/log.h> |
| 4 |
|
| #include <panda/exception.h> |
| 5 |
|
| |
| 6 |
|
| // typemaps |
| 7 |
|
| namespace xs { |
| 8 |
|
| template <> struct Typemap<panda::log::Level> : TypemapBase<panda::log::Level> { |
| 9 |
|
| static inline panda::log::Level in (SV* sv) { |
| 10 |
|
| int l = SvIV(sv); |
| 11 |
|
| if (l < (int)panda::log::Level::VerboseDebug || l > (int)panda::log::Level::Emergency) throw panda::exception("invalid log level"); |
| 12 |
|
| return (panda::log::Level)l; |
| 13 |
|
| } |
| 14 |
155 |
| static inline Sv out (panda::log::Level l, const Sv& = {}) { |
| 15 |
155 |
▶ | return Simple((int)l); |
Branch: 1 branch
| Branch | True | False | Total |
| return Simple((int)l); |
155 |
0 |
155 |
|
| 16 |
|
| } |
| 17 |
|
| }; |
| 18 |
|
| |
| 19 |
|
| template <class TYPE> struct Typemap<panda::log::ILogger*, TYPE> : TypemapObject<panda::log::ILogger*, TYPE, ObjectTypeRefcntPtr, ObjectStorageMGBackref> { |
| 20 |
0 |
| static panda::string package () { return "XLog::ILogger"; } |
| 21 |
|
| }; |
| 22 |
|
| |
| 23 |
|
| template <> struct Typemap<panda::log::ILoggerSP> : Typemap<panda::log::ILogger*> { |
| 24 |
|
| static panda::log::ILoggerSP in (Sv arg); |
| 25 |
|
| }; |
| 26 |
|
| |
| 27 |
|
| template <class TYPE> struct Typemap<panda::log::IFormatter*, TYPE> : TypemapObject<panda::log::IFormatter*, TYPE, ObjectTypeRefcntPtr, ObjectStorageMGBackref> { |
| 28 |
0 |
| static panda::string package () { return "XLog::IFormatter"; } |
| 29 |
|
| }; |
| 30 |
|
| |
| 31 |
|
| template <> struct Typemap<panda::log::IFormatterSP> : Typemap<panda::log::IFormatter*> { |
| 32 |
|
| static panda::log::IFormatterSP in (Sv arg); |
| 33 |
|
| }; |
| 34 |
|
| |
| 35 |
|
| template <class TYPE> struct Typemap<panda::log::Module*, TYPE> : TypemapObject<panda::log::Module*, TYPE, ObjectTypeForeignPtr, ObjectStorageMG> { |
| 36 |
|
| static panda::string package () { return "XLog::Module"; } |
| 37 |
|
| }; |
| 38 |
|
| } |