@@ -78,7 +78,56 @@ public function warning(...$item) {
7878 public function success (...$ item ) {
7979 $ this ->noticeRaw ('success ' , $ item );
8080 }
81-
81+
82+ public function noticeLog (...$ item ) {
83+ $ this ->logRaw ('notice ' , $ item );
84+ }
85+
86+ public function errorLog (...$ item ) {
87+ $ this ->logRaw ('error ' , $ item );
88+ }
89+
90+ public function warningLog (...$ item ) {
91+ $ this ->logRaw ('warning ' , $ item );
92+ }
93+
94+ public function successLog (...$ item ) {
95+ $ this ->logRaw ('success ' , $ item );
96+ }
97+
98+ public function logRaw ($ type , ...$ item ) {
99+
100+ if (empty ($ item )) {
101+ return ;
102+ }
103+
104+ $ pathLogFile = $ this ->configuratorDebugger ->getLogPath ($ type );
105+
106+ if ($ pathLogFile ) {
107+ $ keyCache = $ type . '_log_file_descriptor ' ;
108+
109+ $ fileLogDescriptor = null ;
110+
111+ if (RuntimeCache::has ($ keyCache )) {
112+ $ fileLogDescriptor = RuntimeCache::get ($ keyCache );
113+ } else {
114+ $ fileLogDescriptor = \fopen ($ pathLogFile , 'a+ ' );
115+ RuntimeCache::set ($ keyCache , $ fileLogDescriptor );
116+ }
117+
118+ if ($ fileLogDescriptor ) {
119+ foreach ($ item as $ logItem ) {
120+ // @todo возможность вывести через var_dump, var_export
121+ FileWriter::write (
122+ print_r ($ logItem , true ),
123+ $ fileLogDescriptor ,
124+ $ this ->configuratorDebugger ->getLogChunkDelimeter ()
125+ );
126+ }
127+ }
128+ }
129+ }
130+
82131 public function getLog (): array {
83132 return $ this ->log ;
84133 }
@@ -102,39 +151,6 @@ protected function noticeRaw(string $type, $arLogItems) {
102151 if (ShowModeDebuggerValidator::needShowInCode ($ this )) {
103152
104153 }
105-
106- if (ShowModeDebuggerValidator::needWriteInLog ($ this )) {
107-
108- if (empty ($ arLogItems )) {
109- return ;
110- }
111-
112- $ pathLogFile = $ this ->configuratorDebugger ->getLogPath ($ type );
113-
114- if ($ pathLogFile ) {
115- $ keyCache = $ type . '_log_file_descriptor ' ;
116-
117- $ fileLogDescriptor = null ;
118-
119- if (RuntimeCache::has ($ keyCache )) {
120- $ fileLogDescriptor = RuntimeCache::get ($ keyCache );
121- } else {
122- $ fileLogDescriptor = \fopen ($ pathLogFile , 'a+ ' );
123- RuntimeCache::set ($ keyCache , $ fileLogDescriptor );
124- }
125-
126- if ($ fileLogDescriptor ) {
127- foreach ($ arLogItems as $ logItem ) {
128- // @todo возможность вывести через var_dump, var_export
129- FileWriter::write (
130- print_r ($ logItem , true ),
131- $ fileLogDescriptor ,
132- $ this ->configuratorDebugger ->getLogChunkDelimeter ()
133- );
134- }
135- }
136- }
137- }
138154 }
139155
140156}
0 commit comments