1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

os: merge with filepath

This commit is contained in:
yuyi
2020-03-08 05:26:26 +08:00
committed by GitHub
parent 5e541e1f11
commit 783dee1f48
57 changed files with 249 additions and 361 deletions

View File

@@ -4,7 +4,6 @@ import (
os
time
term
filepath
)
pub enum LogLevel {
@@ -69,8 +68,8 @@ pub fn (l mut Log) set_output_level(level LogLevel) {
pub fn (l mut Log) set_full_logpath(full_log_path string) {
rlog_file := os.realpath( full_log_path )
l.set_output_label( filepath.filename( rlog_file ) )
l.set_output_path( filepath.basedir( rlog_file ) )
l.set_output_label( os.filename( rlog_file ) )
l.set_output_path( os.basedir( rlog_file ) )
}
pub fn (l mut Log) set_output_label(label string){
@@ -80,7 +79,7 @@ pub fn (l mut Log) set_output_label(label string){
pub fn (l mut Log) set_output_path(output_file_path string) {
if l.ofile.is_opened() { l.ofile.close() }
l.output_to_file = true
l.output_file_name = filepath.join( os.realpath( output_file_path ) , l.output_label )
l.output_file_name = os.join( os.realpath( output_file_path ) , l.output_label )
ofile := os.open_append( l.output_file_name ) or {
panic('error while opening log file ${l.output_file_name} for appending')
}
@@ -137,4 +136,3 @@ pub fn (l mut Log) debug(s string) {
if l.level < .debug { return }
l.send_output(s, .debug)
}