namespace OC\Log;
+use OC\SystemConfig;
use OCP\Log\IWriter;
-class Errorlog implements IWriter {
+class Errorlog extends LogDetails implements IWriter {
/** @var string */
protected $tag;
}
/**
- * write a message in the log
+ * Write a message in the log
+ *
* @param string $app
- * @param string $message
+ * @param string|array $message
* @param int $level
*/
public function write(string $app, $message, int $level) {
- error_log('[' . $this->tag . ']['.$app.']['.$level.'] '.$message);
+ error_log('[' . $this->tag . ']['.$app.']['.$level.'] '.$this->logDetailsAsJSON($app, $message, $level));
}
}
public function get(string $type):IWriter {
switch (strtolower($type)) {
case 'errorlog':
- return new Errorlog();
+ return new Errorlog($this->systemConfig);
case 'syslog':
return $this->c->resolve(Syslog::class);
case 'systemd':
protected function createNewLogger(string $type, string $tag, string $path): IWriter {
switch (strtolower($type)) {
case 'errorlog':
- return new Errorlog($tag);
+ return new Errorlog($this->systemConfig, $tag);
case 'syslog':
return new Syslog($this->systemConfig, $tag);
case 'systemd':
/**
* write a message in the log
* @param string $app
- * @param string $message
+ * @param string|array $message
* @param int $level
*/
public function write(string $app, $message, int $level) {
/**
* Write a message to the log.
* @param string $app
- * @param string $message
+ * @param string|array $message
* @param int $level
*/
public function write(string $app, $message, int $level) {
interface IWriter {
/**
* @since 14.0.0
+ *
+ * @param string $app
+ * @param string|array $message
+ * @param int $level
*/
public function write(string $app, $message, int $level);
}