1010// terms that can be accessed at https://unidoc.io/eula/
1111
1212// Package common contains common properties used by the subpackages.
13- package common ;import (_f "fmt" ;_gf "io" ;_g "os" ;_bg "path/filepath" ;_ca "runtime" ;_c "time" ;);
13+ package common ;import (_df "fmt" ;_a "io" ;_b "os" ;_c "path/filepath" ;_f "runtime" ;_g "time" ;);
1414
15- // NewConsoleLogger creates new console logger.
16- func NewConsoleLogger (logLevel LogLevel )* ConsoleLogger {return & ConsoleLogger {LogLevel :logLevel }};
17-
18- // Notice does nothing for dummy logger.
19- func (DummyLogger )Notice (format string ,args ... interface {}){};
15+ // Trace does nothing for dummy logger.
16+ func (DummyLogger )Trace (format string ,args ... interface {}){};
2017
21- // SetLogger sets 'logger' to be used by the unidoc unipdf library .
22- func SetLogger ( logger Logger ){ Log = logger }; const _eab = 30 ;
18+ // IsLogLevel returns true from dummy logger .
19+ func ( DummyLogger ) IsLogLevel ( level LogLevel ) bool { return true } ;
2320
24- // Info logs info message.
25- func (_fc WriterLogger )Info (format string ,args ... interface {}){if _fc .LogLevel >= LogLevelInfo {_ecc := "\u005b I\u004e \u0046 \u004f \u005d \u0020 " ;_fc .logToWriter (_fc .Output ,_ecc ,format ,args ... );};};
21+ // Debug logs debug message.
22+ func (_fdb ConsoleLogger )Debug (format string ,args ... interface {}){if _fdb .LogLevel >= LogLevelDebug {_gcb := "\u005b \u0044 \u0045 \u0042 \u0055 \u0047 \u005d \u0020 " ;_fdb .output (_b .Stdout ,_gcb ,format ,args ... );};};var Log Logger = DummyLogger {};func _ba (_gfc _a .Writer ,_gfa string ,_acb string ,_be ... interface {}){_ ,_bb ,_acf ,_ade := _f .Caller (3 );
23+ if ! _ade {_bb = "\u003f \u003f \u003f " ;_acf = 0 ;}else {_bb = _c .Base (_bb );};_bef := _df .Sprintf ("\u0025 s\u0020 \u0025 \u0073 \u003a \u0025 \u0064 " ,_gfa ,_bb ,_acf )+ _acb + "\u000a " ;_df .Fprintf (_gfc ,_bef ,_be ... );};
2624
2725// Notice logs notice message.
28- func (_fb WriterLogger )Notice (format string ,args ... interface {}){if _fb .LogLevel >= LogLevelNotice {_fgg := "\u005b N\u004f \u0054 \u0049 \u0043 \u0045 \u005d " ;_fb .logToWriter (_fb .Output ,_fgg ,format ,args ... );};};
29-
30- // UtcTimeFormat returns a formatted string describing a UTC timestamp.
31- func UtcTimeFormat (t _c .Time )string {return t .Format (_efc )+ "\u0020 \u0055 \u0054 \u0043 " };const (LogLevelTrace LogLevel = 5 ;LogLevelDebug LogLevel = 4 ;LogLevelInfo LogLevel = 3 ;LogLevelNotice LogLevel = 2 ;LogLevelWarning LogLevel = 1 ;LogLevelError LogLevel = 0 ;
32- );
33-
34- // Info logs info message.
35- func (_be ConsoleLogger )Info (format string ,args ... interface {}){if _be .LogLevel >= LogLevelInfo {_afb := "\u005b I\u004e \u0046 \u004f \u005d \u0020 " ;_be .output (_g .Stdout ,_afb ,format ,args ... );};};
26+ func (_egb WriterLogger )Notice (format string ,args ... interface {}){if _egb .LogLevel >= LogLevelNotice {_gdba := "\u005b N\u004f \u0054 \u0049 \u0043 \u0045 \u005d " ;_egb .logToWriter (_egb .Output ,_gdba ,format ,args ... );};};const _bdb = 3 ;func (_ge WriterLogger )logToWriter (_dd _a .Writer ,_bdc string ,_dcd string ,_gcg ... interface {}){_ba (_dd ,_bdc ,_dcd ,_gcg );
27+ };
3628
3729// DummyLogger does nothing.
38- type DummyLogger struct {};
39-
40- // Warning logs warning message.
41- func (_ab ConsoleLogger )Warning (format string ,args ... interface {}){if _ab .LogLevel >= LogLevelWarning {_gff := "\u005b \u0057 \u0041 \u0052 \u004e \u0049 \u004e \u0047 \u005d \u0020 " ;_ab .output (_g .Stdout ,_gff ,format ,args ... );};};
42-
43- // Debug logs debug message.
44- func (_gbe WriterLogger )Debug (format string ,args ... interface {}){if _gbe .LogLevel >= LogLevelDebug {_eccg := "\u005b \u0044 \u0045 \u0042 \u0055 \u0047 \u005d \u0020 " ;_gbe .logToWriter (_gbe .Output ,_eccg ,format ,args ... );};};
30+ type DummyLogger struct {};const (LogLevelTrace LogLevel = 5 ;LogLevelDebug LogLevel = 4 ;LogLevelInfo LogLevel = 3 ;LogLevelNotice LogLevel = 2 ;LogLevelWarning LogLevel = 1 ;LogLevelError LogLevel = 0 ;);var ReleasedAt = _g .Date (_eee ,_bdb ,_af ,_bg ,_gcf ,0 ,0 ,_g .UTC );
31+ const _eae = "\u0032 \u0020 \u004a an\u0075 \u0061 \u0072 \u0079 \u0020 \u0032 \u0030 \u0030 \u0036 \u0020 \u0061 \u0074 \u0020 \u0031 \u0035 \u003a \u0030 \u0034 " ;
4532
4633// Error does nothing for dummy logger.
47- func (DummyLogger )Error (format string ,args ... interface {}){};func _db (_df _gf .Writer ,_cb string ,_feb string ,_gg ... interface {}){_ ,_eaf ,_dbd ,_bc := _ca .Caller (3 );if ! _bc {_eaf = "\u003f \u003f \u003f " ;_dbd = 0 ;}else {_eaf = _bg .Base (_eaf );};_bea := _f .Sprintf ("\u0025 s\u0020 \u0025 \u0073 \u003a \u0025 \u0064 " ,_cb ,_eaf ,_dbd )+ _feb + "\u000a " ;
48- _f .Fprintf (_df ,_bea ,_gg ... );};
34+ func (DummyLogger )Error (format string ,args ... interface {}){};
4935
50- // Debug does nothing for dummy logger.
51- func (DummyLogger )Debug (format string ,args ... interface {}){};const _da = 2 ;const _gag = 15 ;
36+ // IsLogLevel returns true if log level is greater or equal than `level`.
37+ // Can be used to avoid resource intensive calls to loggers.
38+ func (_cd WriterLogger )IsLogLevel (level LogLevel )bool {return _cd .LogLevel >= level };
5239
53- // NewWriterLogger creates new 'writer' logger.
54- func NewWriterLogger (logLevel LogLevel , writer _gf . Writer ) * WriterLogger { _egd := WriterLogger { Output : writer , LogLevel :logLevel }; return & _egd ; };
40+ // NewConsoleLogger creates new console logger.
41+ func NewConsoleLogger (logLevel LogLevel ) * ConsoleLogger { return & ConsoleLogger { LogLevel :logLevel }};
5542
56- // Info does nothing for dummy logger .
57- func ( DummyLogger ) Info ( format string , args ... interface {}){ };
43+ // UtcTimeFormat returns a formatted string describing a UTC timestamp .
44+ func UtcTimeFormat ( t _g . Time ) string { return t . Format ( _eae ) + " \u0020 \u0055 \u0054 \u0043 " };
5845
59- // Trace logs trace message .
60- func ( _abc ConsoleLogger ) Trace ( format string , args ... interface {}){ if _abc . LogLevel >= LogLevelTrace { _ff := " \u005b \u0054 \u0052 \u0041 \u0043 \u0045 \u005d \u0020 " ; _abc . output ( _g . Stdout , _ff , format , args ... );};}; const _dg = 22 ;
46+ // NewWriterLogger creates new 'writer' logger .
47+ func NewWriterLogger ( logLevel LogLevel , writer _a . Writer ) * WriterLogger { _dff := WriterLogger { Output : writer , LogLevel : logLevel }; return & _dff ;} ;
6148
6249// Logger is the interface used for logging in the unipdf package.
63- type Logger interface {Error (_e string ,_cg ... interface {});Warning (_a string ,_d ... interface {});Notice (_ac string ,_ec ... interface {});Info (_ecg string ,_eg ... interface {});Debug (_gb string ,_ga ... interface {});Trace (_bd string ,_acd ... interface {});
64- IsLogLevel (_dc LogLevel )bool ;};
50+ type Logger interface {Error (_gg string ,_gd ... interface {});Warning (_gb string ,_aa ... interface {});Notice (_e string ,_ea ... interface {});Info (_ce string ,_eg ... interface {});Debug (_gde string ,_ad ... interface {});Trace (_fd string ,_fa ... interface {});
51+ IsLogLevel (_cb LogLevel )bool ;};
6552
66- // Error logs error message.
67- func (_afd WriterLogger ) Error (format string ,args ... interface {}){if _afd .LogLevel >= LogLevelError { _ad := "\u005b \u0045 \u0052 \u0052 \u004f \u0052 \ u005d\u0020 " ;_afd . logToWriter ( _afd . Output , _ad ,format ,args ... );};};
53+ // Warning logs warning message.
54+ func (_ee ConsoleLogger ) Warning (format string ,args ... interface {}){if _ee .LogLevel >= LogLevelWarning { _bf := "\u005b \u0057 \u0041 \u0052 \u004e \u0049 \u004e \u0047 \ u005d\u0020 " ;_ee . output ( _b . Stdout , _bf ,format ,args ... );};}; const _eee = 2025 ;
6855
69- // IsLogLevel returns true from dummy logger .
70- func (DummyLogger ) IsLogLevel ( level LogLevel ) bool { return true };
56+ // Notice logs notice message .
57+ func (_eb ConsoleLogger ) Notice ( format string , args ... interface {}){ if _eb . LogLevel >= LogLevelNotice { _gf := " \u005b N \u004f \u0054 \u0049 \u0043 \u0045 \u005d " ; _eb . output ( _b . Stdout , _gf , format , args ... );}; };
7158
72- // Debug logs debug message.
73- func (_cgg ConsoleLogger ) Debug (format string ,args ... interface {}){if _cgg .LogLevel >= LogLevelDebug { _ded := "\u005b \u0044 \u0045 \u0042 \u0055 \u0047 \ u005d\u0020 " ;_cgg . output ( _g . Stdout , _ded ,format ,args ... );};};
59+ // Info logs info message.
60+ func (_dga WriterLogger ) Info (format string ,args ... interface {}){if _dga .LogLevel >= LogLevelInfo { _dc := "\u005b I \u004e \u0046 \u004f \ u005d\u0020 " ;_dga . logToWriter ( _dga . Output , _dc ,format ,args ... );};};
7461
7562// IsLogLevel returns true if log level is greater or equal than `level`.
7663// Can be used to avoid resource intensive calls to loggers.
77- func (_gd WriterLogger )IsLogLevel (level LogLevel )bool {return _gd .LogLevel >= level };
64+ func (_ae ConsoleLogger )IsLogLevel (level LogLevel )bool {return _ae .LogLevel >= level };
7865
79- // Trace does nothing for dummy logger .
80- func (DummyLogger ) Trace (format string ,args ... interface {}){} ;
66+ // Debug logs debug message .
67+ func (_cbc WriterLogger ) Debug (format string ,args ... interface {}){if _cbc . LogLevel >= LogLevelDebug { _fc := " \u005b \u0044 \u0045 \u0042 \u0055 \u0047 \u005d \u0020 " ; _cbc . logToWriter ( _cbc . Output , _fc , format , args ... );};}; const _af = 20 ;
8168
82- // Error logs error message.
83- func (_egg ConsoleLogger ) Error (format string ,args ... interface {}){if _egg .LogLevel >= LogLevelError { _aa := "\u005b \u0045 \u0052 \u0052 \u004f \u0052 \ u005d\u0020 " ;_egg . output ( _g . Stdout , _aa ,format ,args ... );};};
69+ // Warning logs warning message.
70+ func (_ef WriterLogger ) Warning (format string ,args ... interface {}){if _ef .LogLevel >= LogLevelWarning { _cba := "\u005b \u0057 \u0041 \u0052 \u004e \u0049 \u004e \u0047 \ u005d\u0020 " ;_ef . logToWriter ( _ef . Output , _cba ,format ,args ... );};};
8471
85- // WriterLogger is the logger that writes data to the Output writer
86- type WriterLogger struct { LogLevel LogLevel ; Output _gf . Writer ;};
72+ // Error logs error message.
73+ func ( _cg WriterLogger ) Error ( format string , args ... interface {}){ if _cg . LogLevel >= LogLevelError { _ca := " \u005b \u0045 \u0052 \u0052 \u004f \u0052 \u005d \u0020 " ; _cg . logToWriter ( _cg . Output , _ca , format , args ... );} ;};
8774
88- // Warning logs warning message.
89- func (_ffe WriterLogger )Warning (format string ,args ... interface {}){if _ffe .LogLevel >= LogLevelWarning { _fg := "\u005b \u0057 \u0041 \ u0052\u004e \u0049 \u004e \u0047 \ u005d\u0020 " ;_ffe .logToWriter (_ffe .Output ,_fg ,format ,args ... );};};const Version = "\u0033 \u002e \u0036 \u0037 \u002e \u0030 " ;
75+ // Trace logs trace message.
76+ func (_cad WriterLogger )Trace (format string ,args ... interface {}){if _cad .LogLevel >= LogLevelTrace { _acd := "\u005b \u0054 \ u0052\u0041 \u0043 \u0045 \ u005d\u0020 " ;_cad .logToWriter (_cad .Output ,_acd ,format ,args ... );};};const Version = "\u0033 \u002e \u0036 \u0038 \u002e \u0030 " ;
9077
9178
92- // IsLogLevel returns true if log level is greater or equal than `level`.
93- // Can be used to avoid resource intensive calls to loggers.
94- func (_ea ConsoleLogger )IsLogLevel (level LogLevel )bool {return _ea .LogLevel >= level };
79+ // Trace logs trace message.
80+ func (_ac ConsoleLogger )Trace (format string ,args ... interface {}){if _ac .LogLevel >= LogLevelTrace {_gdb := "\u005b \u0054 \u0052 \u0041 \u0043 \u0045 \u005d \u0020 " ;_ac .output (_b .Stdout ,_gdb ,format ,args ... );};};
9581
96- // LogLevel is the verbosity level for logging .
97- type LogLevel int ;
82+ // Info does nothing for dummy logger .
83+ func ( DummyLogger ) Info ( format string , args ... interface {}){} ;
9884
99- // Notice logs notice message.
100- func (_de ConsoleLogger )Notice (format string ,args ... interface {}){if _de .LogLevel >= LogLevelNotice {_af := "\u005b N\u004f \u0054 \u0049 \u0043 \u0045 \u005d " ;_de .output (_g .Stdout ,_af ,format ,args ... );};};func (_ee ConsoleLogger )output (_bf _gf .Writer ,_eb string ,_ef string ,_dee ... interface {}){_db (_bf ,_eb ,_ef ,_dee ... );
101- };func (_bde WriterLogger )logToWriter (_cc _gf .Writer ,_cf string ,_ge string ,_acf ... interface {}){_db (_cc ,_cf ,_ge ,_acf );};
85+ // WriterLogger is the logger that writes data to the Output writer
86+ type WriterLogger struct {LogLevel LogLevel ;Output _a .Writer ;};
10287
103- // Trace logs trace message.
104- func (_ag WriterLogger )Trace (format string ,args ... interface {}){if _ag .LogLevel >= LogLevelTrace {_fe := "\u005b \u0054 \u0052 \u0041 \u0043 \u0045 \u005d \u0020 " ;_ag .logToWriter (_ag .Output ,_fe ,format ,args ... );};};const _efc = "\u0032 \u0020 \u004a an\u0075 \u0061 \u0072 \u0079 \u0020 \u0032 \u0030 \u0030 \u0036 \u0020 \u0061 \u0074 \u0020 \u0031 \u0035 \u003a \u0030 \u0034 " ;
105- var ReleasedAt = _c .Date (_dedg ,_da ,_dg ,_gag ,_eab ,0 ,0 ,_c .UTC );
88+ // Info logs info message.
89+ func (_dg ConsoleLogger )Info (format string ,args ... interface {}){if _dg .LogLevel >= LogLevelInfo {_bc := "\u005b I\u004e \u0046 \u004f \u005d \u0020 " ;_dg .output (_b .Stdout ,_bc ,format ,args ... );};};
10690
10791// Warning does nothing for dummy logger.
10892func (DummyLogger )Warning (format string ,args ... interface {}){};
10993
94+ // Debug does nothing for dummy logger.
95+ func (DummyLogger )Debug (format string ,args ... interface {}){};
96+
97+ // Error logs error message.
98+ func (_gc ConsoleLogger )Error (format string ,args ... interface {}){if _gc .LogLevel >= LogLevelError {_dfd := "\u005b \u0045 \u0052 \u0052 \u004f \u0052 \u005d \u0020 " ;_gc .output (_b .Stdout ,_dfd ,format ,args ... );};};
99+
100+ // Notice does nothing for dummy logger.
101+ func (DummyLogger )Notice (format string ,args ... interface {}){};
102+
103+ // SetLogger sets 'logger' to be used by the unidoc unipdf library.
104+ func SetLogger (logger Logger ){Log = logger };const _bg = 15 ;const _gcf = 30 ;
105+
106+ // LogLevel is the verbosity level for logging.
107+ type LogLevel int ;
108+
110109// ConsoleLogger is a logger that writes logs to the 'os.Stdout'
111- type ConsoleLogger struct {LogLevel LogLevel ;};var Log Logger = DummyLogger {}; const _dedg = 2025 ;
110+ type ConsoleLogger struct {LogLevel LogLevel ;};func ( _ceb ConsoleLogger ) output ( _gbg _a . Writer , _ed string , _bd string , _de ... interface {}){ _ba ( _gbg , _ed , _bd , _de ... );} ;
0 commit comments