Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Init logs and set paths for the project
if (!require('logger')) install.packages('logger'); library('logger')
start_time_pipeline <- Sys.time()
log_debug('Training pipeline start time - {start_time_pipeline}')
# Local directories
ROOT_DIR <- getwd()
PROJECT_DIR <-
'r-api-data-hackers'
DATA_DIR <- 'data'
MODELS_DIR <- 'models'
API_DIR <- 'api'
LOGS_DIR <- 'logs'
get_artifact_path <- function(file_name,
artifact_dir,
root_dir=ROOT_DIR,
project_dir=PROJECT_DIR){
artifact_path <-
file.path(root_dir,
project_dir,
artifact_dir,
file_name)
return (artifact_path)
}
logging_file_path <-
get_artifact_path("training_pipeline_auto_ml.log", LOGS_DIR)
log_appender(appender_file(logging_file_path))
log_layout(layout_glue_colors)
log_threshold(DEBUG)
log_info('Start logging')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.